Printable idea sheet
lsp_incremental_sync
reqlan rq/extension/language/support/ts-lsp-vs-rust-gaps.rq:58
Katz 0.126
The Rust server syncs open buffers with incremental didChange.
didOpen sends the full text. Each didChange applies its content changes in order, then reparses the whole buffer.
A change with no range replaces the buffer. A change with a range splices that UTF-16 range. rangeLength is ignored.
. rq and comment buffers both splice.
Open and close notifications stay on.
The node server keeps Langium incremental sync.
Related: language_server_rust, lsp_migration_remainder.
- implementation
- utf16.rs, session.rs, server.rs
- plan
- goal
Rust didChange applies ordered UTF-16 edits, then the existing full reparse.
constraints
- TextDocumentSyncOptions sets openClose and change Incremental.
- Positions are UTF-16. The buffer is UTF-8.
- Several edits in one notification apply in order against the updated buffer.
- Parse, diagnostics, and the hot/confirm sequence stay as they are.
steps
1. apply_content_changes in utf16.rs.
2. Session applies the result through change or open.
3. Advertise the sync options.
4. Tests below.
open
- none - status
- done
- tests
- utf16.rs:replaces_a_word, utf16.rs:inserts_a_newline, utf16.rs:deletes_across_a_newline, utf16.rs:applies_later_ranges_to_the_updated_buffer, utf16.rs:snaps_a_surrogate_pair_to_the_next_char, utf16.rs:omitted_range_replaces_the_buffer, utf16.rs:range_length_does_not_move_the_splice, session.rs:incremental_change_renames_an_unresolved_idea, session.rs:incremental_change_updates_a_comment_reference
Interactive page: lsp_incremental_sync