This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
🐛 Incorrect handling of incremental LSP changes #4094
Labels
A-LSP
Area: language server protocol
S-Bug: confirmed
Status: report has been confirmed as a valid bug
Environment information
What happened?
It appears there is a bug with handling of the
textDocument/didChange
LSP request.(Note that this reproduces in Sublime Text when using sublimelsp/LSP-rome#1 but I don't expect you to set it up to test.)
With a document like:
cmd
+/
/*
and trailing*/
characters which results in:textDocument/didChange
notification:at which point its internal state gets confused as evident by the diagnostic which says
Note how the server still sees the trailing
*/
which was removed.As far as I can see this bug triggers because of the order of changes in the
contentChanges
list. When the order is from top to bottom of the document then the bug triggers. Otherwise not.I've tried reproducing it in VSCode by selecting both ranges and removing them with backspace but VSCode sends changes in opposite order so it doesn't reproduce there.
Expected result
Server should correctly process didChange notification regardless of the order of changes.
ST behavior is valid per spec. The server just has to ensure that the change it is currently applying is applied for the document state that includes previously applied change.
Code of Conduct
The text was updated successfully, but these errors were encountered: