Describes a single edit applied to a buffer's content.
Edit deltas are used for incremental content sync with the tree-sitter parser process. Instead of sending the entire file content after each change, the BEAM sends compact deltas that describe what changed and where. The parser applies these to its stored copy of the source and performs an incremental reparse.
Fields
start_byte— byte offset where the edit beginsold_end_byte— byte offset where the old (removed) text endsnew_end_byte— byte offset where the new (inserted) text endsstart_position—{line, col}atstart_byteold_end_position—{line, col}atold_end_bytenew_end_position—{line, col}atnew_end_byteinserted_text— the text that was inserted (empty for pure deletions)
Summary
Functions
Creates a delta for a deletion at a position (no text inserted).
Creates a delta for an insertion at a position (no text removed).
Creates a delta for a replacement (text removed and text inserted).
Types
@type t() :: %Minga.Buffer.EditDelta{ inserted_text: String.t(), new_end_byte: non_neg_integer(), new_end_position: {non_neg_integer(), non_neg_integer()}, old_end_byte: non_neg_integer(), old_end_position: {non_neg_integer(), non_neg_integer()}, start_byte: non_neg_integer(), start_position: {non_neg_integer(), non_neg_integer()} }
Functions
@spec deletion( non_neg_integer(), non_neg_integer(), {non_neg_integer(), non_neg_integer()}, {non_neg_integer(), non_neg_integer()} ) :: t()
Creates a delta for a deletion at a position (no text inserted).
@spec insertion( non_neg_integer(), {non_neg_integer(), non_neg_integer()}, String.t(), {non_neg_integer(), non_neg_integer()} ) :: t()
Creates a delta for an insertion at a position (no text removed).
@spec replacement( non_neg_integer(), non_neg_integer(), {non_neg_integer(), non_neg_integer()}, {non_neg_integer(), non_neg_integer()}, String.t(), {non_neg_integer(), non_neg_integer()} ) :: t()
Creates a delta for a replacement (text removed and text inserted).