haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.65k stars 354 forks source link

HLS current version incompatability problem #3019

Open houseofwealth opened 2 years ago

houseofwealth commented 2 years ago

Your environment

Which OS do you use: Windows 10

Which LSP client (editor/plugin) do you use:

VS Code 1.68.1

Describe your project (alternative: link to the project):

haskell project built using Stack. stack.yaml resolver: lts-14.21.

Steps to reproduce

After installing the Haskell Language extension, try to browse for a definition within a file. VS Code reports a Problem with the file as described below

Expected behaviour

Should jump to the definition

Actual behaviour

ghcide compiled against GHC 9.2.2 but currently using 8.6.5 
This is unsupported, ghcide must be compiled with the same GHC version as the project.

The HLS page says that the current version of HLS supports 8.6.5, which does not appear to be the case. It is not clear what version of HLS should be used. This is supposed to work without needed ghcup

Include debug information

fendor commented 2 years ago

It seems a bit lost in the documentation, but you need to compile HLS with the same GHC version you want to use in your project. In this case, if you need GHC 8.6.5, you need to compile HLS with GHC 8.6.5 and this message will vanish.

To do that, the recommended way is to use cabal via cabal install -w ghc-8.6.5 or something similar.

michaelpj commented 2 years ago

Well, it sounds like @houseofwealth is using the vscode extension, so that should have downloaded the appropriate wrapper, right? So something has gone wrong there.

fendor commented 2 years ago

They are deliberately not using ghcup, see this issue: https://github.com/haskell/vscode-haskell/issues/630

michaelpj commented 2 years ago

It seems a bit lost in the documentation

I disagree that it's buried in the docs, it's in the section on installing from source, I'm not sure where else it would be: https://haskell-language-server.readthedocs.io/en/latest/installation.html#installation-from-source

houseofwealth commented 2 years ago

OK thanks for that clarification. I wasn't aware that I needed to compile it from source - I just downloaded the supplied binary. I will try that out and let you know

michaelpj commented 2 years ago

I actually have no idea how you obtained your HLS binaries, you didn't say :)

houseofwealth commented 2 years ago

Its on that same page https://haskell-language-server.readthedocs.io/en/latest/installation.html#pre-built-binaries

houseofwealth commented 2 years ago

So i tried the stack install --stack-yaml stack-<GHCVER>.yaml command but where is the stack-8.6.5.yaml to be found?

houseofwealth commented 2 years ago

I also pulled the source from github, and ran "stack build" but stack seems to think that it needs to build it with ghc 9.x which is definitely not what I want, since that was the source of the original problem, it needs to build it with ghc 8.6.5. . I am not sure if this is the way to go or not, I just thought I'd try it out

drsooch commented 2 years ago

I also pulled the source from github, and ran "stack build" but stack seems to think that it needs to build it with ghc 9.x which is definitely not what I want, since that was the source of the original problem, it needs to build it with ghc 8.6.5.

. I am not sure if this is the way to go or not, I just thought I'd try it out

Looks like our oldest stack.yaml is for 8.8.4. You can try to search the commit history for the 8.6.5 stack.yaml file.

fendor commented 2 years ago

Its on that same page https://haskell-language-server.readthedocs.io/en/latest/installation.html#pre-built-binaries

Easy fix then, download the release binaries for hls 8.6.5, or point the server executable path to the haskell-language-server-wrapper.

I disagree that it's buried in the docs

I am, as usual, completely blind. I don't know why I have such a hard time reading our own docs 😅

lsmor commented 2 years ago

Disclaimer: I've seen some legit complaints like this thread in the last couple of months. This is a summary of what I've seen and what I've tested myself, but since this is very system dependant I am not completely sure about all the claims.

Some behaviours should be properly documented since it seems to be dispersed around multiple pages. I am refering to the following problems:

In summary:

I think It would be convinient a page in the documentation like how to set up a develoment enviroment. Ideally this section should be completely straightfoward (a few commands and indications, that's it.). If you are happy with this, I am willing to write such a guide.