Closed mrcjkb closed 7 months ago
It should also be good if this plugin can detect the haskell-language-server version we should use. I have haskell-language-server in my path but it's complaining that the version of ghcide doesn't match my package.
I search here and got https://www.reddit.com/r/haskell/comments/i8rfx0/ghcide_compiled_against_ghc_865_but_currently/
But I have no clue how to fix the issue.
@glyh, thanks for the suggestion.
haskell-language-server
needs to be compiled with the same version of ghc
that you're using to compile your project.
Detecting which version to use would fall into the category of package management, which is outside the scope of this plugin. If you're looking for something like this, there are various different approaches you can choose from:
flake.nix
file, so if you have nix installed, you can just run nix develop
in the project's root directory, and you'll enter a shell with everything you need on the PATH
.ghc
version) and a wrapper that detects which one to use.haskell-language-server
in its package registry.Hello, I'm using ghcup with stack 2.9.3, hls 2.0.0.1, ghc 9.2.8 and cabal 3.6.2. But I am still getting the errors. If I remember correctly mason hls is broken, arch's haskell packages are broken as well and that's the very reason I'm using ghcup.
I don't want to use nix shell because it takes too much time to configure.
If you're using ghcup with stack, you may need to configure stack to use the ghc
binaries managed by ghcup.
See also vscode-haskell#ghc-abis-dont-match.
As installing haskell-language-server is beyond the scope of this plugin, I suggest you ask on IRC, in the haskell tooling matrix channel, or open an issue in the haskell-language-server repository if you're still facing issues.
Arch's static Haskell packages (in the AUR) don't seem to be broken. But they may have the same issue with stack.
ghcup on NixOS is a PITA: the package is broken for half a year, and binaries from the website have a dynamic loader, so in my opinion this option could be pretty useful (the executable override)
This has been supported for a while - I just forgot about the issue :smile:
With the current version of this plugin, there are multiple ways you can dynamically set the cmd
:
:h exrc
:
If enabled, you can set vim.g.haskell_tools
in .nvim.lua
, .nvimrc
, or .exrc
files in the project root.vim.g.haskell_tools
can also be a function. So you can use that to determine the project you're in and return a value accordingly.vim.g.haskell_tools.hls.cmd
can also be either a list of strings or a function that returns a list of strings.The first two methods won't work if you load multiple projects with the same Neovim session, as vim.g.haskell_tools
is sourced into an internal config only once, when opening a Haskell file.
If hls.cmd
is a function, it is evaluated every time the LSP client starts, so this method can be used with multiple projects in the same session.
ghcup on NixOS is a PITA: the package is broken for half a year, and binaries from the website have a dynamic loader, so in my opinion this option could be pretty useful (the executable override)
If you only need to override the cmd
, that has always been supported. See :h haskell-tools.config
and :h HaskellLspClientOpts
.
damn, how did I miss that I swear I Read TFM thanks for the help 🙇♂️
Feature description
This would be useful e.g. to set
cmd = cabal run haskell-language-server -- --lsp
in the hls project.