haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 212 forks source link

HIE doesn't find cabal #1663

Open pmiddend opened 4 years ago

pmiddend commented 4 years ago

I've set up hie using all-hies on a NixOS system. Opening a Haskell file and explicitly invoking first direnv-mode and then lsp results in an error in *hie::stderr* saying it cannot find Cabal == 3.0.0.0.

Opening a terminal, changing to the directory and executing cabal --version, however, gives:

cabal-install version 3.0.0.0

I read about the direnv and lsp race condition, which is why I explicitly enabled direnv and then lsp, but to no avail.

How can I debug this further?

fendor commented 4 years ago

is this really a hie bug? Can you try to execute hie --debug in the root of your project and if this fails, link some logs? If it succeeds, you can try to pass a filepath like hie --debug src/ to attempt load your project into hie and report the logs. If all that works, the problem is not with hie itself.

pmiddend commented 4 years ago

Alright, so this does not succeed. Find attached the log output of hie --debug:

debug.log

Note, again, that cabal --version does succeed, as does ghc --version (which outputs 8.6.5).

fendor commented 4 years ago

I see! Did you try to run cabal update, btw? However, this looks like a bug in cabal-helper or some nix issue. Would you mind trying whether creating a file hie.yaml with the contents

cradle:
  cabal:

and check if that works?

pmiddend commented 4 years ago

Thanks @fendor! That did the trick.

I don't mind having hie.yaml around, shall I close the issue or is it worth investigating this further?

fendor commented 4 years ago

It looks like a bug of cabal-helper, but since this is issue actually persists, I would prefer to have the issue open so that it documents the problem.