Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrapper: find exe named h-l-s-<ghcVersion>~<hlsVersion> like GHCUP names it #4460

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adamse
Copy link
Contributor

@adamse adamse commented Dec 3, 2024

No description provided.

@adamse adamse requested a review from fendor as a code owner December 3, 2024 19:31
@fendor
Copy link
Collaborator

fendor commented Dec 5, 2024

Hi, thank you for the PR!

What's the motivation for this change? You want the hls-wrapper to automatically pick up any installed HLS binary?
I take it, this is not related to haskell/ghcup-hs#1150?

@adamse
Copy link
Contributor Author

adamse commented Dec 5, 2024

I simply noticed that ghcup names the hls binary in a certain way, and I wished the hls wrapper to find it! This PR is unrelated to anything else, at least to my knowledge :)

$ dirname `which ghc`
/home/a/.ghcup/bin

$ ls -l $(dirname `which ghc`)
total 53209
...
lrwxrwxrwx 1 a users       49 Dec  3 19:21 haskell-language-server-9.10.1~2.9.0.1 -> ../hls/2.9.0.1/bin/haskell-language-server-9.10.1*
lrwxrwxrwx 1 a users       48 Dec  3 19:21 haskell-language-server-9.2.8~2.9.0.1 -> ../hls/2.9.0.1/bin/haskell-language-server-9.2.8*
lrwxrwxrwx 1 a users       48 Dec  3 19:21 haskell-language-server-9.4.8~2.9.0.1 -> ../hls/2.9.0.1/bin/haskell-language-server-9.4.8*
lrwxrwxrwx 1 a users       48 Dec  3 19:21 haskell-language-server-9.6.5~2.9.0.1 -> ../hls/2.9.0.1/bin/haskell-language-server-9.6.5*
lrwxrwxrwx 1 a users       48 Dec  3 19:21 haskell-language-server-9.6.6~2.9.0.1 -> ../hls/2.9.0.1/bin/haskell-language-server-9.6.6*
lrwxrwxrwx 1 a users       48 Dec  3 19:21 haskell-language-server-9.8.2~2.9.0.1 -> ../hls/2.9.0.1/bin/haskell-language-server-9.8.2*
lrwxrwxrwx 1 a users       86 Dec  3 19:21 haskell-language-server-wrapper-2.9.0.1 -> ../hls/2.9.0.1/lib/haskell-language-server-2.9.0.1/bin/haskell-language-server-wrapper*
...

@fendor
Copy link
Collaborator

fendor commented Dec 6, 2024

Ok, so this feature would allow the wrapper haskell-language-server-wrapper-2.9.0.1 (the -2.9.0.1 is not required) to additionally find HLS binaries such as haskell-language-server-<ghc-ver>~2.9.0.1?

I think I see two use-cases here, this allows you to use haskell-language-server-wrapper-2.9.0.1 even when no HLS version is set, and it allows you to change the HLS version per project? E.g., you can specify haskell-language-server-wrapper-<ghc-ver>~2.8.0.0 to use HLS-2.8.0.0 even when it is not set. Is that part of the motivation?

@adamse
Copy link
Contributor Author

adamse commented Dec 6, 2024

I noticed that ghcup installed haskell-language-server-wrapper-2.9.0.1 so I made my LSP client (vim 9 with coc-nvim) use that, but the current wrapper doesn't find the h-l-s-<ghc>~<hls> named exes. Having the wrapper pick up the right exe here is my only motivation.

The error I got was similar too this (but shorter, only the very end was shown inside vim):

$ haskell-language-server-wrapper-2.9.0.1
No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper-2.9.0.1) Version 2.9.0.1 x86_64 ghc-9.10.1
Current directory: /home/a/p/arr-hs
Operating system: linux
Arguments: []
Cradle directory: /home/a/p/arr-hs
Cradle type: Default

Tool versions found on the $PATH
cabal:          3.12.1.0
stack:          2.15.5
ghc:            9.6.6


Consulting the cradle to get project GHC version...
2024-12-06T21:44:46.338742Z | Debug | ghc --numeric-version
Project GHC version: 9.6.6
haskell-language-server exe candidates: ["haskell-language-server-9.6.6","haskell-language-server"]
Failed to find a HLS version for GHC 9.6.6
Executable names we failed to find: haskell-language-server-9.6.6,haskell-language-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants