0

I am using VSCode with the Haskell extension. I have ghcup installed with the following installed:

Stack 2.7.5

HLS 1.7.0.0

Cabal 3.6.2.0

GHC 9.0.2 (set)

GHC 8.10.7

If I have a stack.yaml with lts-18.28 the haskell-language-server boots and the hover works. If I have stack.yaml with lts-19.16 the haskell-language-server crashes.

What do I have to do to get the haskell-language-server to work with lts-19.16?

EDIT

It seems that Ismor's comment to add "system-ghc: true" to the stack.yaml file is on the right lines.

Now nightly-2022-06-06 (with ghc-9.2.2) works.

It seems there is some issue with the 9.0.2 version that stack uses not being the same as HLS, so lts-19.16 still does not work.

Also, nightly-2022-07-30 does not work, but the HLS web pages (https://haskell-language-server.readthedocs.io/en/latest/supported-versions.html) say that ghc-9.2.3 is only partially supported.

Anyway, I can now choose ghc-8.10.7 or ghc-9.2.2 and still use HLS in vscode so that's good enough for me.

EDIT2

See: "ghcup compile hls" here https://www.haskell.org/ghcup/guide/#hls

and see here: https://docs.haskellstack.org/en/stable/Stack_and_VS_Code/

b1g3ar5
  • 53
  • 2
  • 4
  • 1
    Speculation: You may need to use a version of HLS that was compiled with GHC 9.0.2. – sjakobi Jul 28 '22 at 16:24
  • ghcup installed HLS for me. It says (https://github.com/haskell/haskell-language-server/releases/tag/1.7.0.0) that GHC 8.10.7, 9.0.2, 9.2.1, 9.2.3 are all supported. Thanks though. – b1g3ar5 Jul 28 '22 at 16:35
  • Hmm. How is your issue different from https://stackoverflow.com/questions/73084162/why-does-a-project-created-with-stack-new-ghc-9-0-2-crash-the-language-server? – sjakobi Jul 28 '22 at 16:41
  • 1
    I recompiled with resolver: nightly-2022-06-06 which uses ghc-9.2.2 and with ghc 9.2.2 'set' in ghcup - the server crashed with this setup. Is this due to a conflict between stack and ghcup? Might this be an opportune moment to ditch stack and move back to cabal? – b1g3ar5 Jul 28 '22 at 21:59
  • 1
    did you configure `stack` with `system-ghc`?? if not, add the line `system-ghc: true` in your `stack.yaml` – lsmor Jul 30 '22 at 08:03

0 Answers0