You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Disable with LSP API the stop a given language server when all files are closed #556
Originally posted by kdvolder September 25, 2024
One of our use-cases extends the LSP with some custom protocol, this is meant to drive a tree-like information view that isn't tied to a specific file or open editor.
This project does almost exactly what we want (i.e support LSP protocol, and provides means to add additional 'custom' protocol).
But we are struggling with the fact that implementation / apis availabe in the current implementation will trigger server shutdown/disconnect when there are no more open editors (i.e. when `connectedDocuments.isEmpty()' in LanguageServerWrapper).
This is a bit problematic for our use-case because we don't want our 'information display view' to stop working when all editors are closed.
So what we'd like is to have some additional mechanism (i.e. new 'official' API) that allows acquiring a 'lease' on a languageserver connection that remains active and keeps the language server alive until it is explicitly disposed.
This would allow us to:
obtain a connection to language server to communicate using the custom protocol (or standard protocol)
tie the lifetime of this lease to the lifecycle of the view
I'd be interested in discussing about how this might look and in developing it as a PR against this repo.
What do you all think about this?
As to some initial thoughts from me:
I think the right place of this api would probably be in LanguageServiceAccessor. While that class is marked as 'internal api' it has the right kinds of things in it. I would just want to add a method their that specifically supports our use case. I.e. it allows to obtain a LanguageServerLease (this api class/interface has to be created) based on project and a LanguageServerDefinition.
The details of this api would have to be agreed upon ofcourse, and I would do the work of implementing and submitting a PR to implement it.
@kdvolder I have covered your use case with LSP API in current PR #543.
Please read the docs/LSPApi.md from this PR to understand the idea of the LSP client features that you can customize like this:
packagemy.language.server;
importcom.redhat.devtools.lsp4ij.client.features.LSPClientFeatures;
publicclassMyLSPClientFeaturesextendsLSPClientFeatures {
@OverridepublicbooleanisServerStoppingRequiredWhenFilesClosed() {
// Don't stop the language server when all files closedreturnfalse;
}
}
Do you like this method name? If no, any suggestions are welcome!
Activity
angelozerr commentedon Oct 2, 2024
@kdvolder I have covered your use case with LSP API in current PR #543.
Please read the docs/LSPApi.md from this PR to understand the idea of the LSP client features that you can customize like this:
Do you like this method name? If no, any suggestions are welcome!
angelozerr commentedon Oct 3, 2024
@kdvolder please try installing nightly-builds, read doc at https://github.com/redhat-developer/lsp4ij/blob/main/docs/LSPApi.md (keepServerAlive)
For more information ,see #561
angelozerr commentedon Oct 3, 2024
//cc @harry-xm