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

Omit unset ranges for TextDocumentContentChangeEvent #3

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

farhaven
Copy link
Contributor

@farhaven farhaven commented Jun 12, 2024

The Typescript language server checks ranges only for equality to undefined 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 to avoid the Typescript LSP (and possibly others reusing the VSCode LSP code) tripping over range elements being unset, and thus not updating its internal view of text documents when acme-lsp handles a Put.

Fixes 9fans/acme-lsp#75

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
Copy link
Collaborator

@fhs fhs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fhs fhs merged commit b2eeae9 into 9fans:main Jun 21, 2024
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.

Cant reload file with typescript lsp
2 participants