Open andreabedini opened 2 years ago
Yeah, there's clearly some confusion between the workspace root that the client sends us and us auto-detecting something based on hie.yaml
. I'm not 100% sure what the correct behaviour is.
We think the problem may actually be that the HLS changes directory to the root directory immediately. And then the relative path app/Main.hs
no longer points to the right place. The fix should be easy: when we parse the filepath arguments on the command line, we should absolutize/canonicalize them immediately.
HLS uses hie-bios to set up a GHC API session appropriate for the project. From hie-bios, hls inherits the
hie.yaml
which is a way to explicitly describe what kind of project we have (e.g. cabal or stack).In particular hie-bios will use
hie.yaml
to determine the project root directory as described in https://github.com/haskell/hie-bios#explicit-configuration. hie-bios will refer to this directory as the "cradle".I claim hie-bios cradle detection can get hls confused.
Hopefully reproducible example:
this fails with
My reading is that the
hie.yaml
is what determines the crade directory but hls assumes that is the current directory, which is false.Another symptom of the confusion appears using neovim and lsp-config: after opening
nvim app/Main.hs
from thetmp/a
directory;LspInfo
informs me the root istmp/a
(as determined by the client, neovim) but the cache gets created in~/.cache/hie-bios/dist-tmp-...
.ring @michaelpj