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

Support for server->client batch requests? #781

Open
strager opened this issue Jun 25, 2021 · 2 comments
Open

Support for server->client batch requests? #781

strager opened this issue Jun 25, 2021 · 2 comments
Labels
feature-request Request for new features or functionality
Milestone

Comments

@strager
Copy link
Contributor

strager commented Jun 25, 2021

JSON-RPC version 2.0 defines batch requests, where a JSON-RPC client can send multiple requests (including notifications) in one transport message: https://www.jsonrpc.org/specification#batch

My LSP server sends batch requests, but vscode-lspclient seems to ignore these batch requests. From my interpretation of the LSP specification and the JSON-RPC specification, vscode-lspclient's behavior is non-conforming.

Is vscode-lspclient supposed to be conforming to the JSON-RPC version 2.0 specification? Or does vscode-lspclient only support JSON-RPC version 1.0 (which does not have batch requests)?

strager added a commit to quick-lint/quick-lint-js that referenced this issue Jun 25, 2021
As of vscode-jsonrpc version 6.0.0, Visual Studio Code's LSP client does
not support batch JSON-RPC messages [1]. I suspect other LSP clients
also don't support batch messages.

quick-lint-js' LSP server emits batch messages when a config file
changes. Visual Studio Code's LSP client ignores these messages, making
our vscode-lsp extension feel buggy.

Change our LSP server to only emit batch messages if it receives a batch
request.

For JSON-RPC-compliant LSP clients, this commit should not change
behavior.

[1] microsoft/vscode-languageserver-node#781
@dbaeumer
Copy link
Member

@strager there is an item in the protocol itself on how batch requests should be supported. See microsoft/language-server-protocol#988

When we did a initial investigation we noticed that quite some json rpc libraries don't have support for batch requests. This is why we stayed away from it in the LSP protocol and hence I never implemented it in the vscode json-rpc library.

I do agree that request batching is very useful and I would like to find a solution for it for LSP.

@dbaeumer
Copy link
Member

And to answer your questions: the library is currently 2.0 - batch requests. Adding it on the library level is fine for me, but we would still need to decide how to surface this on the protocol level to not break things

@dbaeumer dbaeumer added this to the On Deck milestone Jun 25, 2021
@dbaeumer dbaeumer added feature-request Request for new features or functionality and removed feature request labels Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants