Haskell-language-server keeps crashing

Hello,

I just set up a Haskell environment, but the language server keeps crashing on my stack projects (using the ghc 8.8.4 it chose to install). The log is about version conflicts I don’t really understand. Here is an extract:

Project GHC version: 8.8.4
haskell-language-server exe candidates: ["haskell-language-server-8.8.4","haskell-language-server-8.8","haskell-language-server"]
Cannot find any haskell-language-server exe, looked for: haskell-language-server-8.8.4, haskell-language-server-8.8, haskell-language-server
[Info  - 00:34:17] Connection to server got closed. Server will restart.

And here is an extract of the content of the .ghcup/bin folder (which is in my path):

haskell-language-server-8.6.4
haskell-language-server-8.6.4~0.5.1
haskell-language-server-8.6.5
haskell-language-server-8.6.5~0.5.1
haskell-language-server-8.8.2
haskell-language-server-8.8.2~0.5.1
haskell-language-server-8.8.3
haskell-language-server-8.8.3~0.5.1
haskell-language-server-8.10.1
haskell-language-server-8.8.4~0.5.1
haskell-language-server-8.10.1~0.5.1
haskell-language-server-wrapper
haskell-language-server-8.10.2~0.5.1
haskell-language-server-wrapper-0.5.1

Finally, here is the command launched by the LSP extension in my IDE:

haskell-language-server-wrapper --lsp

Any idea how to correctly set up a Haskell environment using the LSP? This should be straightforward, I have just installed Haskell through ghcup, then installed ghc and stack, then used the command ghcup install hls and started a default stack project…

Thanks in advance!

I personally followed these instructions for stack the other day and was able to get it working.

Thank you for the pointer. I finally downloaded a HLS binary for GHC 8.8.4 from their release page on GitHub, and put it into my .ghcup/bin folder. I then added a hie.yaml file to my workspace, and the IDE found the executable and was able to work correctly.

1 Like