LSP document synchronization
Also called: didOpen, didChange, didClose
Document synchronization keeps a language server’s view aligned with the text being edited, including changes not yet saved to disk. LSP uses document URIs, version numbers and open, change and close notifications. The agreed synchronization mode determines whether a change sends the whole document or an incremental edit. These document versions are unrelated to the LSP revision.
Suppose version 7 contains count=1. An incremental change can replace the final character with 2 and identify the resulting document as version 8. Later analysis should use that updated text. Multiple edits within one change notification apply in sequence, so each edit’s range refers to the document produced by the preceding edit.
- Read first
- Language Server Protocol