I installed ghcup
and:
- Stack 2.9.1
- HLS 1.8.0
- cabal 3.6.2
- GHC 9.2.5
All of them are the recommended versions(I verified it using ghcup tui
). Then I installed the Haskell
extension in VSCode
. Unfortunately, it doesn't work. I get syntax highlighting (from the Haskell Syntax Highlighting
extension, which seems to be automatically installed alongside the Haskell
extension) but there is no Intellisense, no code completion, no error detection and no interactive mode (-->>>
evaluation). I experimented with different folders and haskell files. The filetype is correct, because every time I open a .hs
file, the Haskell extension checks for updates. I even installed Codium
, because I suspected a fault in VSCode
, but it was the same there as well.
The hsl
language server doesn't seem to be working in Neovim, either. I uninstalled ghcup
(ghcup nuke
) and reinstalled again. The result is exactly the same. I prepended the PATH
and chose vanilla and non-vanilla Stack integration in either installations.
Am I doing something wrong?
OS: Linux Mint on Ubuntu 20.04.1
, kernel 5.15.0-56
.
CodePudding user response:
After around 10 tries, I managed to fix the problem. It turned out I had three problems:
- I had only 12 GB free on my Linux partition, but it seems more are needed. I realised it, when it turned out some
haskell-language-server
files were missing. I enlarged my Linux partition (something I should have done months ago). The new installation installed all files - The Haskell Language Server HLS was not added to the PATH. I solved it by putting this snippet in
~/.ghcup/config.yaml
:
"haskell.serverEnvironment": {
"PATH": "${HOME}/.ghcup/bin:$PATH"
}
- The server was now discovered by the
Haskell
VS Code extension but crashed 5 times and gave up on trying. Restarting it manually didn't help. I opened the logs:View
->Output
->Haskell
and saw the error:
haskell-language-server-wrapper: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by haskell-language-server-wrapper)
It turns out, my Linux Mint distribution uses GLIBC_2.31
, not 2.32
. This is a very important library, which most applications on the system use. If you are a newbie, it is strongly advised that you DO NOT update it manually.
- Instead, what I did, was install a version of the
HLS
, which usedGLIBC_2.31
. This problem occured in September and was "fixed" but apparently not very well. There are two options:- download the
HLS deb10
version manually (didn't work for me):
ghcup install hls -u https://downloads.haskell.org/~hls/haskell-language-server-1.8.0.0/h
- download using
ghcup tui
HLS version1.7.0.0
(or whatever newest, which uses yourglibc
version) and a GHC, which supports that particular version of the HLS (in my case9.0.2
).
- download the
- I think it's a good idea to preemptively reinstall the extension, in case it used the PATH to configure the
HLS
, so that its settings are restored to default. It takes up to 20 seconds to initialize the server, so be patient. You can see what's happening in theOutput
window and verify there are no more errors.
I hope this helps.