Avi-D-coder / implicit-hie

Auto generate a stack or cabal multi component hie.yaml file
BSD 3-Clause "New" or "Revised" License
201 stars 17 forks source link

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

Open andrewufrank opened 3 years ago

andrewufrank commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

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

andrewufrank commented 3 years ago

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

andrewufrank commented 3 years ago

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