ApplyDeltaChanges

Function ApplyDeltaChanges 

Source
fn ApplyDeltaChanges(
    Lines: &[String],
    EOL: &str,
    RPCChange: &[RPCModelContentChangeDTO],
) -> Vec<String>
Expand description

Applies delta changes to the document text and returns the updated lines.

This function:

  1. Sorts changes in reverse order (by start position) to prevent offset corruption
  2. Converts line/column positions to byte offsets in the full text
  3. Applies each change (delete range + insert new text)
  4. Splits the result back into lines

§Arguments

  • Lines - The current document lines
  • EOL - The end-of-line sequence to use
  • RPCChange - Array of changes to apply

§Returns

Updated lines vector after applying all changes