Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

silly question about none cradle #250

Closed
teto opened this issue Sep 15, 2020 · 8 comments
Closed

silly question about none cradle #250

teto opened this issue Sep 15, 2020 · 8 comments

Comments

@teto
Copy link
Contributor

teto commented Sep 15, 2020

I am trying to elaborate a multicradle hie.yaml and want to set the base cradle to none and I have a few silly questions:

  • all examples quote the parameter path: ".", isn't path: . ok ?

with a hie.yaml similar to https://github.com/mpickering/hie-bios/blob/master/tests/configs/multi-ch.yaml#L9 (hie-bios being a wrapper around hie-bios built by bazel):

$ hie-bios debug ./does_not_exist
INFO: Invocation ID: 41cc7c54-655d-4c43-b110-c662f1e43e83
INFO: Analyzed target @ghcide-exe//hie-bios:hie-bios (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target @ghcide//:_hie-bios_exe_hie-bios up-to-date:
  bazel-bin/external/ghcide/hie-bios-0.7.1/_install/bin/hie-bios
INFO: Elapsed time: 0.088s, Critical Path: 0.01s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
No cradle

Does it mean it matched my none cradle or none at all ? In the first case, I would rather see a Matched one cradle.

@fendor
Copy link
Collaborator

fendor commented Sep 16, 2020

Sorry for the delay.

  • all examples quote the parameter path: ".", isn't path: . ok ?

Indeed, that works for sure for all of the given examples, but I am not too sure about special cases such as spaces within the path. To avoid problems with yaml, the documentation just uses this variant.

Does it mean it matched my none cradle or none at all ?

It matched the none-cradle. Could be clarified in the source:
https://github.com/mpickering/hie-bios/blob/master/src/HIE/Bios/Internal/Debug.hs#L55

or none at all

In that case it would throw an error

@teto
Copy link
Contributor Author

teto commented Sep 21, 2020

thanks for the response. Since I've started asking stupid questions, I am going to follow up hoping you don't mind ? Maybe these could be useful in a wiki FAQ ?

I have this hie.yaml in /home/teto/project:

cradle:
  multi:
    - path: ./subproject/subproj1
      config:
        cradle:
          bios:
            shell: cat $OUT/subproject1.flags > $HIE_BIOS_OUTPUT
    - path: ./subproject/subproj2
      config:
        cradle:
          bios:
            shell: cat $OUT/subproject2.flags > $HIE_BIOS_OUTPUT

    - path: ./.
      config: { cradle: { none: } }

When I run ghcide/hie-bios version 0.7.1 compiled by GHC 8.8.3 in the hie.yaml folder, it finds 31 cradles e.g.

Found 31 cradles
 (/home/teto/project/hie.yaml, /home/teto/.cache/bazel/_bazel_teto/f3097620197e6c203645e1230d1ae88c/external/ghcide/ghcide-0.4.0/hie.yaml, /home/teto/.cache/bazel/_bazel_teto/f3097620197e
6c203645e1230d1ae88c/external/ghcide/ghcide-0.4.0/test/data/TH/hie.yaml, /home/teto/.cache/bazel/_bazel_teto/f3097620197e6c203645e1230d1ae88c/external/ghcide/ghcide-0.4.0/test/data/boot/hie.yaml .....

1/ I thought it would pick the current one and stop there. Does this mean I can put a hie.yaml in subfolders and they will be picked up/override the one at the root ? I could not see mention of this in the README.

2/ hie-bios finds the cradle /home/teto/.cache/bazel/_bazel_teto/f3097620197e6c203645e1230d1ae88c/external/ghcide/ghcide-0.4.0/hie.yaml via the symlink /home/teto/project -> /home/teto/.cache/bazel/_bazel_teto . Since I've set ./. to the none cradle, I don't expect hie-bios to follow symlinks in this folder ?

3/ The ghcide log gives me

Consulting the cradle for "subproject/subproj43/Simplify.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/home/teto/project", cradleOptsProg = CradleAction: Multi}

In my hie.yaml I have defined cradles only for the paths ./subproject/subproj1 and ./subproject/subproj2. I would expect ./subproject/subproj43 to be match the none cradle but it's not clear from the output.

Maybe all of this resolution is covered in some document in which case I am happy to read it.

@teto
Copy link
Contributor Author

teto commented Sep 21, 2020

Regarding 3/ If I run hie-bios flags subproject/subproj43, I do get No flags: this component should not be loaded so this was a behavior of ghcide, not hie-bios and hie-bios behaves as expected my bad.

@fendor
Copy link
Collaborator

fendor commented Sep 22, 2020

An FAQ would be awesome :)

Does this mean I can put a hie.yaml in subfolders and they will be picked up/override the one at the root ?

Yes, we select the most specific hie.yaml file. Could be added to the readme.

Since I've set ./. to the none cradle, I don't expect hie-bios to follow symlinks in this folder

This should have been resolved by #219. Very weird, can you open a separate issue for that?

In my hie.yaml I have defined cradles only for the paths ./subproject/subproj1 and ./subproject/subproj2. I would expect ./subproject/subproj43 to be match the none cradle but it's not clear from the output.

I agree, it is very hard to debug. The output is correct, though, since it the hie.yaml file describes a multi cradle.
Maybe we can print more debug information in ghcide.

@teto
Copy link
Contributor Author

teto commented Sep 30, 2020

if you open/create the wiki, I can fill it out a bit.

As for 2/ , I don't think it's a matter of symlink. Why is ghcide looking at files ignored by my multicradle ? Nevermind you just answered on IRC that ghcide ignores the hie.yaml when scanning for files.

@teto teto closed this as completed Sep 30, 2020
@ndmitchell
Copy link
Contributor

My experience is a wiki on GitHub just ends up falling into disuse with stale info on it. But some docs in Markdown would be great! (Personal view - there's a chance that the maintainers of this repo feel differently). I think we also need to figure out whether those docs best live here, on in haskell-language-server.

@teto
Copy link
Contributor Author

teto commented Sep 30, 2020

It may be the case if there is a competing documentation somewhere else but this doesn't seem the case yet. I am not a fan of wikis by any means but they lower the barrier for contribution, can help bootstrap a proper doc, and you can remove it later.
Btw thanks for all your work, your initiatives make haskell so much easier.

@fendor
Copy link
Collaborator

fendor commented Sep 30, 2020

I think we also need to figure out whether those docs best live here, on in haskell-language-server.

Personally, I agree, this documentation on how to write a hie.yaml file and how to debug it should exist in haskell-language-server. Otherwise you have to look in two repos to learn how to properly set-up the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants