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

Module not found with custom hie.yaml and bazel #453

Closed
teto opened this issue Oct 2, 2020 · 5 comments
Closed

Module not found with custom hie.yaml and bazel #453

teto opened this issue Oct 2, 2020 · 5 comments
Labels
component: hie-bios status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@teto
Copy link
Contributor

teto commented Oct 2, 2020

Subject of the issue

When opening files with atom/vscode, I have Module not found errors. I use a multicradle with a per-subfolder cradle similar to this one: haskell/hie-bios#250 (comment) , i.e., I have a list of flags in a file on a per-cradle basis. aka (.tmp/subfolder2.flags for the cradle matching path "./subproject2")
If I open file/module A and vscode+hls says file/module B missing. If I run hie-bios check A, it returns 0 with no output (which I assume mean my flags are good and thus contradicts vscode output). the path to B appears in hie-bios flags A.
Now if I open B, the error about the missing B disappears :s

Your environment

  • Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools
    • This command is available since version >= 0.4.0.0
My version of hls is 5729c2ea119e9d48c136cc75c377d41fec811dde (recent).
haskell-language-server version: 0.4.0.0 (GHC: 8.8.3) (PATH: /home/teto/.cache/bazel/_bazel_teto/32070fb26dd3cfe8bd075800f8bb83d1/execroot/toplevel_workspace/bazel-out/k8-fastbuild/bin/external/hls/haskell-language-server-0.4.0.0/_install/bin/haskell-language-server)
Tool versions found on the $PATH
cabal:		Not found
stack:		2.3.1
ghc:		8.8.3

Steps to reproduce

can't share the code sry :'(

Expected behaviour

No error about missing module

Actual behaviour

Error about missing module

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:
So I can't paste all the logs but here is an excerpt. Because I use bazel to build we don't have .cabal files and also my hie.yaml ignores all the files in bazel-out/ (where haskell packages can be stored) which points at my /home/teto/.cache/bazel/_bazel_teto/

Debug output:
Hidden:   no
Range:    13:17-13:36
Source:   not found
Severity: DsError
Message: 
  Could not find module ‘Options.Applicative’
  It is not a module in the current program, or in any known package.
[INFO] Consulting the cradle for "/home/teto/.cache/bazel/_bazel_teto/32070fb26dd3cfe8bd075800f8bb83d1/execroot/toplevel_workspace/bazel-out/k8-fastbuild/bin/simwork/examples/DummDiff@scenarized_Main.hs"
NotShowMessage (NotificationMessage {_jsonrpc = "2.0", _method = WindowShowMessage, _params = ShowMessageParams {_xtype = MtWarning, _message = "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for /home/teto/.cache/bazel/_bazel_teto/32070fb26dd3cfe8bd075800f8bb83d1/execroot/toplevel_workspace/bazel-out/k8-fastbuild/bin/simwork/examples/DummDiff@scenarized_Main.hs.\n Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie)"}})
Output from setting up the cradle Cradle {cradleRootDir = "/home/teto/nova/jinko", cradleOptsProg = CradleAction: Default}

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs:
2020-10-02 17:17:38.469240769 [ThreadId 7] - <--2--{"jsonrpc":"2.0","params":{"uri":"file:///home/teto/nova/jinko/simwork/jinquantities/library/Data/Quantities/Convert.hs","diagnostics":[{"sev
erity":1,"range":{"start":{"line":12,"character":22},"end":{"line":12,"character":50}},"source":"not found","message":"Could not find module ‘Data.Quantities.Constructors’\nIt is not a module 
in the current program, or in any known package."}]},"method":"textDocument/publishDiagnostics
@fendor
Copy link
Collaborator

fendor commented Oct 2, 2020

Output from setting up the cradle Cradle {cradleRootDir = "/home/teto/nova/jinko", cradleOptsProg = CradleAction: Default}

This seems unlikely to be correct. It should almost definitely not be a Default cradle. Is the cradle root correct?

@teto
Copy link
Contributor Author

teto commented Oct 2, 2020

thanks for always taking the time to answer my issues.
The cradle root is correct. Inside this root /home/teto/nova/jinko, there is a symlink /home/teto/nova/jinko/bazel-bin that points at home/teto/.cache/bazel/_bazel_teto/. As in my hie.yaml I have an entry path: ./. => cradle: none I think /home/teto/.cache/bazel/_bazel_teto/32070fb26dd3cfe8bd075800f8bb83d1/execroot/toplevel_workspace/bazel-out/k8-fastbuild/bin/simwork/examples/DummDiff@scenarized_Main.hs should be covered by a none cradle ? Also /home/teto/.cache/bazel/_bazel_teto/32070fb26dd3cfe8bd075800f8bb83d1/execroot/toplevel_workspace/bazel-out/k8-fastbuild/bin/simwork/examples/DummDiff@scenarized_Main.hs may be loaded because I reference this very file as a bios flag in another cradle .

Not sure what "default" means there (implicit ?)

@jneira jneira added component: hie-bios type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Oct 3, 2020
@fendor
Copy link
Collaborator

fendor commented Oct 29, 2020

Late answer (but better late than never I assume):

Easiest way to check is to use hie-bios debug <filepath> and look at the output.

Not sure what "default" means there (implicit ?)

Default means basically: use straight "ghc" with no further options. With current changes to ghcide, this basically means, don't do anything, as we don't discover targets implicitly.

@jneira
Copy link
Member

jneira commented Dec 2, 2020

@teto do you continue having this issue or did you find any workaround? From the comments i guess it should work with the correct explicit hie.yamlfile

@jneira jneira added the status: needs info Not actionable, because there's missing information label Dec 2, 2020
@teto
Copy link
Contributor Author

teto commented Jan 20, 2021

I've managed to squash some of the issues: explnation at haskell/hie-bios#275.

Some other errors elude me but I think I can create more specific issues

@teto teto closed this as completed Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hie-bios status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

3 participants