lang/haskell: provide a default hls

This commit is contained in:
Ching Pei Yang 2026-05-07 23:07:20 +02:00
parent 831a8d6e0b
commit 94d11abc8f
No known key found for this signature in database
GPG key ID: B3841364253DC4C8
2 changed files with 26 additions and 4 deletions

View file

@ -53,10 +53,11 @@ in {
> [!NOTE]
>
> Since HLS is very picky about the GHC version, we do not provide
> a default HLS. You'll have to install your own. It is recommended
> to install `haskell-language-server` in a devShell, along with the
> GHC version you need.
> Since HLS is very sensitive about the GHC version, there's a very
> high chance that the default HLS we use is not compatible with your
> project. It is highly recommended to set
> {option}`vim.languages.haskell.extensions.haskell-tools-nvim.setupOpts.hls.cmd`
> to `null` and install HLS separately in a `devShell`.
'';
};
};

View file

@ -1,13 +1,16 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.types) mkLspPresetEnableOption;
inherit (lib.generators) mkLuaInline;
inherit (lib.trivial) warn;
cfg = config.vim.lsp.presets.haskell-tools;
lspCfg = config.vim.lsp.servers.haskell-tools;
in {
options.vim.lsp.presets.haskell-tools = {
enable = mkLspPresetEnableOption "haskell-tools-nvim" "Haskell" ["haskell"];
@ -43,6 +46,24 @@ in {
languages.haskell.extensions.haskell-tools-nvim = {
enable = true;
setupOpts = {
hls = {
cmd =
if (lspCfg.cmd != null)
then
warn ''
config.vim.lsp.servers.haskell-tools.cmd: this option is
ignored by haskell-tools, use
vim.languages.haskell.extensions.haskell-tools-nvim.setupOpts.hls.cmd
instead.
''
lspCfg.cmd
else [
"${pkgs.haskellPackages.haskell-language-server}/bin/haskell-language-server"
"--lsp"
];
};
};
};
};
};