Skip to content

Feature suggestion: server can send idle notification to signal readiness #1367

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

Closed
squidfunk opened this issue Oct 22, 2021 · 2 comments
Closed

Comments

@squidfunk
Copy link

Problem

From my understanding of the spec, the language client has currently no way to know the state of the server, e.g. whether the server is still busy processing textDocument/did* events, updating the language model, or whatever it needs to do on changes. Thus, after sending a textDocument/didChange notification, some clients impose an arbitrary delay, before language features are requested from the server, like for example textDocument/documentSymbol.

Proposed solution

A language server could send an idle notification to the language client, for which a client could register. Each time the language server receives a notification, it can send an idle notification after finishing processing, to signal that the language model has been updated and the server is able to handle requests again. The debouncing that is already happening on the client-side could then be interrupted by the receiving of such a notification, making typing more instant for language servers that are fast. It would be downward-compatible since clients would have to support it deliberately.

Related

@dbaeumer
Copy link
Member

Actually we decided it solve this different. Server can (mostly for new request) signal a busy state which asks the client to resend the request.

See ServerCancelled here https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#errorCodes

A client needs to opt in into this but it would need opt into an idle request as well.

@squidfunk
Copy link
Author

Thanks for the answer. The problem I see with this is that the client won't know without asking the server that the server is still busy, so an initial request must always be sent. This doesn't allow for short-circuiting debounce intervals, as it only tells the client to "ask later", without specifying what later is (which is of course impossible). A push-based approach would have the benefit of being easier to react to on the client side.

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