pub struct AppliedEdit {
pub original_range: Range,
pub inserted_range: Range,
pub replaced_text: String,
pub inserted_text: String,
pub delta: EditDelta,
}Expand description
What an apply_edit produced. The caller uses this to log change events
and to construct an inverse Edit for the undo stack.
inserted_text is the text that was placed into inserted_range. We
keep it on the struct so subscribers (notably the LSP fan-in, which
needs range + text per change) don’t have to re-read the buffer
after every applied edit.
delta is the tree-sitter-shaped sibling: byte/position deltas
the syntax worker uses to drive incremental reparse via
Tree::edit + Parser::parse(_, Some(&old_tree)). Constructed
from values already computed during the rope mutation – no
extra rope reads. See [EditDelta] for field semantics.
Fields§
§original_range: RangeThe range the edit targeted, in pre-edit coordinates (exactly the
[Edit::range] that was applied).
inserted_range: RangeWhere the inserted text now sits, in post-edit coordinates: starts at
original_range.start and ends after the last inserted byte. Empty
for a pure delete.
replaced_text: StringThe text the edit removed from original_range (empty for a pure
insert). Replacing inserted_range with this text undoes the edit.
inserted_text: StringThe text the edit placed at inserted_range (empty for a pure
delete).
delta: EditDeltaByte offsets and positions of the edit in tree-sitter’s
InputEdit shape. Byte offsets are absolute (from the start of the
buffer) and saturate at u32::MAX.
Trait Implementations§
Source§impl Clone for AppliedEdit
impl Clone for AppliedEdit
Source§fn clone(&self) -> AppliedEdit
fn clone(&self) -> AppliedEdit
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more