Skip to content

Disallow JSON-RPC batch messages#1651

Merged
dbaeumer merged 1 commit into
microsoft:gh-pagesfrom
strager:no-batch
Jan 27, 2023
Merged

Disallow JSON-RPC batch messages#1651
dbaeumer merged 1 commit into
microsoft:gh-pagesfrom
strager:no-batch

Conversation

@strager

@strager strager commented Jan 26, 2023

Copy link
Copy Markdown
Contributor

JSON-RPC 2.0 has a feature called "batch" where multiple requests and notifications can be grouped together into one message.

As an LSP server author, I have never seen an LSP client send these batch messages. I suspect that most LSP clients do not support receiving batch messages either, but I have not tried. The TypeScript type definitions in the LSP do not mention batch messages either.

Furthermore, disallowing batch messages has a few benefits:

  • improves compatibility between servers and clients
  • reduces the risk of LSP servers triggering bugs (including security bugs) in LSP clients, and vice versa
  • reduces development time for conforming LSP servers and clients

Make the LSP match the status quo: Explicitly state in the language server protocol specification that batch messages are not allowed.

@strager strager mentioned this pull request Jan 26, 2023
Comment thread _specifications/lsp/3.18/specification.md
JSON-RPC 2.0 has a feature called "batch" where multiple requests and
notifications can be grouped together into one message.

As an LSP server author, I have never seen an LSP client send these
batch messages. I suspect that most LSP clients do not support receiving
batch messages either, but I have not tried. The TypeScript type
definitions in the LSP do not mention batch messages either.

Furthermore, disallowing batch messages has a few benefits:

* improves compatibility between servers and clients
* reduces the risk of LSP servers triggering bugs (including security
  bugs) in LSP clients, and vice versa
* reduces development time for conforming LSP servers and clients

Make the LSP match the status quo: Explicitly state in the language
server protocol specification that batch messages are not allowed.
@dbaeumer dbaeumer enabled auto-merge (squash) January 27, 2023 07:47
@dbaeumer dbaeumer merged commit a39f28c into microsoft:gh-pages Jan 27, 2023
strager added a commit to quick-lint/quick-lint-js that referenced this pull request Jan 27, 2023
The Language Server Protocol dropped support for JSON-RPC 2.0 batch
messages:
microsoft/language-server-protocol#1651

Such messages were poorly supported by LSP clients anyway, so
quick-lint-js only accepted batched messages, never sent batch messages.

Drop support for batch messages entirely. This will let us simplify the
design of our LSP code in the future.

BREAKING CHANGE: LSP clients which send batched requests and
notifications will now receive a parse error from quick-lint-js' LSP
server (code -32700).
strager added a commit to quick-lint/quick-lint-js that referenced this pull request Jan 27, 2023
The Language Server Protocol dropped support for JSON-RPC 2.0 batch
messages:
microsoft/language-server-protocol#1651

Such messages were poorly supported by LSP clients anyway, so
quick-lint-js only accepted batched messages, never sent batch messages.

Drop support for batch messages entirely. This will let us simplify the
design of our LSP code in the future.

BREAKING CHANGE: LSP clients which send batched requests and
notifications will now receive a parse error from quick-lint-js' LSP
server (code -32700).
strager added a commit to quick-lint/quick-lint-js that referenced this pull request Jan 27, 2023
The Language Server Protocol dropped support for JSON-RPC 2.0 batch
messages:
microsoft/language-server-protocol#1651

Such messages were poorly supported by LSP clients anyway, so
quick-lint-js only accepted batched messages, never sent batch messages.

Drop support for batch messages entirely. This will let us simplify the
design of our LSP code in the future.

BREAKING CHANGE: LSP clients which send batched requests and
notifications will now receive a parse error from quick-lint-js' LSP
server (code -32700).
strager added a commit to quick-lint/quick-lint-js that referenced this pull request Jan 27, 2023
The Language Server Protocol dropped support for JSON-RPC 2.0 batch
messages:
microsoft/language-server-protocol#1651

Such messages were poorly supported by LSP clients anyway, so
quick-lint-js only accepted batched messages, never sent batch messages.

Drop support for batch messages entirely. This will let us simplify the
design of our LSP code in the future.

BREAKING CHANGE: LSP clients which send batched requests and
notifications will now receive a parse error from quick-lint-js' LSP
server (code -32700).
strager added a commit to quick-lint/quick-lint-js that referenced this pull request Jan 27, 2023
The Language Server Protocol dropped support for JSON-RPC 2.0 batch
messages:
microsoft/language-server-protocol#1651

Such messages were poorly supported by LSP clients anyway, so
quick-lint-js only accepted batched messages, never sent batch messages.

Drop support for batch messages entirely. This will let us simplify the
design of our LSP code in the future.

BREAKING CHANGE: LSP clients which send batched requests and
notifications will now receive a parse error from quick-lint-js' LSP
server (code -32700).
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

Successfully merging this pull request may close these issues.

3 participants