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

Automatically restart language servers which exit unexpectedly #6398

Open
the-mikedavis opened this issue Mar 21, 2023 · 1 comment · May be fixed by #10640
Open

Automatically restart language servers which exit unexpectedly #6398

the-mikedavis opened this issue Mar 21, 2023 · 1 comment · May be fixed by #10640
Labels
A-language-server Area: Language server client C-enhancement Category: Improvements E-medium Call for participation: Experience needed to fix: Medium / intermediate

Comments

@the-mikedavis
Copy link
Member

#4797 left automatic restarts for langauge servers as future work. We should automatically restart a language server that exits unexpectedly some fixed number of times before giving up on it. We should give up after a number of tries since a language server could exit immediately after starting repeatedly. After that, :lsp-restart can be used to manually restart it.

@the-mikedavis the-mikedavis added C-enhancement Category: Improvements A-language-server Area: Language server client E-medium Call for participation: Experience needed to fix: Medium / intermediate labels Mar 21, 2023
@sscheele
Copy link
Contributor

I don't have any code to show for it, but I spent some time looking at this and wanted to leave some info here in case it's useful to someone who's better at Rust than I am.

It seems to me that the important changes here would live in the code for the LSP Registry (currently in helix-lsp/src/lib.rs) and in Transport.recv() (currently in helix-lsp/src/transport.rs). The status of a Client can be queried by checking if client._process.id() is a None, in which case the client is dead and should be restarted. But this check would probably have to be triggered by an Error::StreamClosed caught asynchronously in Transport.recv(), which means an async block which currently isn't aware of the registry needs to mutate the registry (or be changed so that it can propagate the error to somewhere more suitable). I don't know enough async stuff do do this yet, but hopefully this comment can save some time for someone who does.

@l4l l4l linked a pull request Apr 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client C-enhancement Category: Improvements E-medium Call for participation: Experience needed to fix: Medium / intermediate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants