Skip to main content

apply_change

Function apply_change 

Source
pub fn apply_change(text: &str, range: Option<Range>, new_text: &str) -> String
Expand description

Apply one textDocument/didChange content change to text, returning the new document.

Supports incremental sync: a Some(range) splices new_text over the byte span the range covers; a None range is a whole-document replacement (the editor sent the full text). The range is treated as ordered and clamped to the document, so a malformed event can’t panic.