Skip to content

dont propose to restart ghc when not available #4006

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

Open
teto opened this issue Jan 22, 2024 · 6 comments
Open

dont propose to restart ghc when not available #4006

teto opened this issue Jan 22, 2024 · 6 comments
Labels
type: enhancement New feature or request

Comments

@teto
Copy link
Contributor

teto commented Jan 22, 2024

Is your enhancement request related to a problem?

I have almost nothing in my global PATH and configure tooling on a per-project basis.
Only when entering a development shell (via nix develop), I get my LSP, compilers etc. available.

My current issue is that whenever I open my haskell projects with neovim for a quick look/edit without entering the nix-shell, I get this annoying popup "Failed to find the GHC version of this Cabal project.". This takes the focus and thus I first have to escape the prompt before doing anything. Restarting is bound to fail as there is no ghc in PATH

image

Describe the solution you'd like

I would like to be able to disable the prompt but still get the error. If there is a LSP knob for that, it should be in hls but maybe it's something to configure in neovim, I am not sure yet.

Describe alternatives you've considered

None

Additional context

First (wrongly) reported at
mrcjkb/haskell-tools.nvim#338 (comment)

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initializeError

@michaelpj
Copy link
Collaborator

Yes, I think there is a knob in the spec. We can set the error data on the response error that we send to the initialize request with a field to say whether or not the client should retry. I think the default assumption is "yes", so it's probably helpful to explicitly say "no" since probably that's usually the right answer.

@michaelpj michaelpj added level: easy The issue is suited for beginners and removed status: needs triage labels Jan 22, 2024
@michaelpj
Copy link
Collaborator

I'm actually not sure there are any errors where we want the client to blindly restart?

@fendor
Copy link
Collaborator

fendor commented Jan 22, 2024

The intention of this command was to give users some time to look at the error, fix their environment, and then press "try to restart". Previously, vscode would just restart HLS 5 times, fail and then show an additional error message over our own, distracting further from the issue at hand.

I don't have an issue with adding a setting to disable the current behaviour, but I do think the "try to restart" should stay the default.

@teto
Copy link
Contributor Author

teto commented Jan 22, 2024

Could this be configured through initializationOptions ? initializeParams I dont mind the warning, just the prompt that steals focus.

@michaelpj
Copy link
Collaborator

Huh, so it's actually something we send and not automatic retry handling by the client? Then ignore everything I said 😂

@fendor
Copy link
Collaborator

fendor commented Jan 23, 2024

Could this be configured through initializationOptions ? initializeParams I dont mind the warning, just the prompt that steals focus.

Not trivially, in the case of setup errors, e.g. the wrapper had to error out before finding the correct HLS version, we are not handling the initialiseOptions but only send that request.

See #2589 for a little bit of context for that feature.

@michaelpj michaelpj removed the level: easy The issue is suited for beginners label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants