implicit-hie icon indicating copy to clipboard operation
implicit-hie copied to clipboard

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

Open andrewufrank opened this issue 4 years ago • 4 comments
trafficstars

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!

andrewufrank avatar May 03 '21 08:05 andrewufrank

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:

fendor avatar May 03 '21 08:05 fendor

@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

jneira avatar May 03 '21 10:05 jneira

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

andrewufrank avatar May 03 '21 17:05 andrewufrank

@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!

andrewufrank avatar May 03 '21 17:05 andrewufrank