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

error: No prefixes matches for default hie in a simple project #36

Open
andrewufrank opened this issue May 3, 2021 · 4 comments
Open

Comments

@andrewufrank
Copy link

I use vscode and have installed implicite-hie with cabal for ghc 8.10.4. when I start HLS in vscode I get the error message:

{
	"resource": "/home/frank/Workspace11/uniformBase/uniformSources/uniform-algebras/app/Main.hs",
	"owner": "Haskell (uniform-algebras)",
	"severity": 8,
	"message": "Multi Cradle: No prefixes matched\npwd: /home/frank/Workspace11/uniformBase/uniformSources/uniform-algebras\nfilepath: /home/frank/Workspace11/uniformBase/uniformSources/uniform-algebras/app/Main.hs\nprefixes:\n(\"src\",Cabal {component = Just \"lib:uniform-algebras\"})\n",
	"source": "cradle",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 2,
	"endColumn": 1
}

The project is build with cabal build and contains a trivial main in app and three modules in lib/uniform-algebra.

The same appears when I create the craddle with gen-hie > hie.yaml. The result is that HLS does not work for this directory (it works on other directories in other projects. What do I wrong?
Thank you for HLS.. when it works it is very helpful!

@fendor
Copy link
Collaborator

fendor commented May 3, 2021

Not knowing anything about this particular issue of implicit-hie, but there is also cabal-hie which generates a hie.yaml based on the generated plan.json (in other words, you need to call cabal build before cabal-hie works).

Additionally, if you use cabal 3.4 you don't need a generated hie.yaml as cabal is smart enough to figure it out on its own.
It is enough to have a hie.yaml:

cradle:
  cabal:

@jneira
Copy link
Collaborator

jneira commented May 3, 2021

@andrewufrank hi, thanks for the bug report, although the workaround provided by @fendor would make it work, it should work out-of-the-box too
could you paste the hie.yaml generated by gen-hie and the .cabal file?
From the logs:

  • it tries to load /home/frank/Workspace11/uniformBase/uniformSources/uniform-algebras/app/Main.hs
  • but the hie.yaml does not have the prefix for the executable only for the lib: src\

So if the .cabal file has an excutable stanza, this would be a implicit-hie bug

@andrewufrank
Copy link
Author

@jneira: I have to check later (at the moment there is no executable).

@andrewufrank
Copy link
Author

@fendor: thank you for the clarification. I was not aware that I could use cabal-hie - could you see that documentation could be improved? I am grateful that it is automatic and a minimal cradle is all what is needed. Now I can start HLS without getting error message about no prefix matches. I hope it works as intended now! Thank you for help!

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