Skip to content

Commit

Permalink
Omit unset ranges for TextDocumentContentChangeEvent
Browse files Browse the repository at this point in the history
The Typescript language server [checks ranges only for equality to `undefined`](https://github.com/microsoft/vscode-languageserver-node/blob/1ce790dd341a38da1fbf902cddc16ce456149de0/protocol/src/common/protocol.ts#L1915) to determine if a change is incremental.

This means that unset ranges need to be omitted completely from the generated messages instead of encoding them as `null`.

Fixes 9fans/acme-lsp#75
  • Loading branch information
farhaven authored and fhs committed Jun 21, 2024
1 parent bb36aa8 commit b2eeae9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lsp/protocol/generate/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var goplsStar = map[prop]int{
{"Lit_SemanticTokensClientCapabilities_requests_full_Item1", "delta"}: nothing, // A.B.C.D
{"Lit_SemanticTokensOptions_full_Item1", "delta"}: nothing, // A.B.C.

{"Lit_TextDocumentContentChangeEvent_Item0", "range"}: wantStar, // == nil test
{"Lit_TextDocumentContentChangeEvent_Item0", "range"}: wantOptStar, // == nil test, TS LSP checks for undefined instead of null.

{"TextDocumentClientCapabilities", "codeAction"}: wantOpt, // A.B.C.D
{"TextDocumentClientCapabilities", "completion"}: wantOpt, // A.B.C.D
Expand Down
2 changes: 1 addition & 1 deletion lsp/protocol/tsprotocol.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b2eeae9

Please sign in to comment.