Haskell-language-server-wrapper only looks for the hls version that is "set"

I have 2 projects on my system. One uses GHCI 9.4.8 and one uses the latest GHCI
GHCI 9.4.8 requires a HLS which is 2.2.0.0
While the latest one requites the latest HLS
I have installed both the HLS

in vscode, the plugin automatically picks the one required regardless of what is set.
but in vim, it doesn’t, nor in helix because they run the command

haskell-language-server-wrapper which when run in the GHCI-9.4.8 project gives the error

haskell-language-server exe candidates: ["haskell-language-server-9.4.6","haskell-language-server"]
Failed to find a HLS version for GHC 9.4.6
Executable names we failed to find: haskell-language-server-9.4.6,haskell-language-server

But this proves that I have it in my system

So how can we allow the wrapper to automatically look for the HLS that are not “set” but are installed as the vscode extension does

I think the problem is rather that the HLS binaries in your PATH has the ~2.2.0.0 suffix. How did you install HLS? I use Nix to manage my toolchain but AFAIK installing it with GHCup should not result in those names with suffixes either.

I have plenty of such files in my .ghcup directory.

% find ~/.ghcup -iname '*~*'
/home/tom/.ghcup/bin/haskell-language-server-9.2.8~2.5.0.0
/home/tom/.ghcup/bin/haskell-language-server-9.4.8~2.7.0.0
/home/tom/.ghcup/bin/haskell-language-server-9.6.4~2.7.0.0
/home/tom/.ghcup/bin/haskell-language-server-9.2.8~2.7.0.0
/home/tom/.ghcup/bin/haskell-language-server-9.6.3~2.5.0.0
/home/tom/.ghcup/bin/haskell-language-server-9.8.2~2.7.0.0
/home/tom/.ghcup/bin/haskell-language-server-9.4.8~2.5.0.0
/home/tom/.ghcup/bin/haskell-language-server-9.8.1~2.5.0.0

I’m a helix user. In my case, I manually change the currently set HLS with ghcup to the version that I need… You could try to set up a custom /dir/dir/youproject/.helix/languages.toml with a different HLS set, maybe copy-pasting the default config, changing the path/command used to find the haskell-language-server-etc binary you want to use :slight_smile: