LSP allows for synchronization (textDocument/didChange
) to be incremental, as long as client and server support this.
Implementing support for this on the server's side, I am confused how the server is supposed to correctly order[^1] these incremental edits.
The server gets DidChangeTextDocumentParams
containing VersionedTextDocumentIdentifier
with a version
field, that is documented as follows (emphasis: mine):
[...] The version number of a document will increase after each change, including undo/redo. The number doesn't need to be consecutive.
If it can be non-consecutive, then how can the server find out if it has missed a change?
In this context, I have also wondered, if there is any way to request a full synchronization of a document from the client, when the server suspects it is out of sync? This would mitigate the issue, at least.
[^1]: most of the time they're received in the right order of course, and my implementation does work fine