Skip to main content

AppliedEdit

Struct AppliedEdit 

Source
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: Range

The range the edit targeted, in pre-edit coordinates (exactly the [Edit::range] that was applied).

§inserted_range: Range

Where 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: String

The text the edit removed from original_range (empty for a pure insert). Replacing inserted_range with this text undoes the edit.

§inserted_text: String

The text the edit placed at inserted_range (empty for a pure delete).

§delta: EditDelta

Byte 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

Source§

fn clone(&self) -> AppliedEdit

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AppliedEdit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.