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

Initialization-state handling #347

Open
PerMildner opened this issue Aug 3, 2019 · 3 comments
Open

Initialization-state handling #347

PerMildner opened this issue Aug 3, 2019 · 3 comments

Comments

@PerMildner
Copy link

When implementing a LSP server it would be nice if LSP4J could maintain the initialization-state, e.g. automatically respond with the required errors if a request arrives before initialize or after shutdown.

A bug in Sublime Text (LSP 0.8.5) sometimes cause it to send a spurious shutdown message before a didOpen and with automatic state-handling in LSP4J these kinds of client bugs would be easier to pinpoint (and it would attach the blame with the buggy client instead of with a possibly crashing server).

It is of course trivial to do the necessary state handling in (all) the server(s) without support in LSP4J but it seems reasonable to move such common functionality to LSP4J.

@spoenemann
Copy link
Contributor

LanguageServer is an interface. How could LSP4J provide this functionality? Add an abstract class that implements that interface, to be used as superclass for your implementation?

@PerMildner
Copy link
Author

Indeed. This functionality does not belong in the LanguageServer interface. It would reside in the parts of LSP4J that call methods in LanguageServer.

For instance, before LSP4J has called LanguageServer.initialize(), LSP4J knows that most LSP requestes and notifications should return an error to the client immediately, and LSP4J should not call the corresponding method in LanguageServer.

@spoenemann
Copy link
Contributor

I tend to regard such default method implementations as out of scope for LSP4J, but we can keep this open to see whether there is more interest about that.

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

No branches or pull requests

2 participants