struct TreeState {
root: SyntaxNode,
edits: Vec<PathEdit>,
changed: Vec<SyntaxPath>,
original_annotations: Vec<TrackedAnnotation>,
annotations: Vec<TrackedAnnotation>,
}Expand description
The evolving immutable root and location metadata for one source tree.
A syntax edit can involve the editor root plus several detached factory trees. Each receives an independent state so dependent edits can be applied before a generated tree is inserted elsewhere.
Fields§
§root: SyntaxNode§edits: Vec<PathEdit>§changed: Vec<SyntaxPath>§original_annotations: Vec<TrackedAnnotation>§annotations: Vec<TrackedAnnotation>Implementations§
Source§impl TreeState
impl TreeState
Sourcefn new(root: SyntaxNode) -> Self
fn new(root: SyntaxNode) -> Self
Starts tracking an unmodified immutable root.
Sourcefn map_original_path(&self, path: SyntaxPath) -> Option<SyntaxPath>
fn map_original_path(&self, path: SyntaxPath) -> Option<SyntaxPath>
Replay structural edits to translate an original path into this state.
Sourcefn map_original_element(&self, element: &SyntaxElement) -> SyntaxElement
fn map_original_element(&self, element: &SyntaxElement) -> SyntaxElement
Finds a change target in the current root.
Sourcefn splice(
&mut self,
parent_path: SyntaxPath,
deleted: Range<usize>,
inserted: Vec<PreparedElement>,
track_as_changed: bool,
)
fn splice( &mut self, parent_path: SyntaxPath, deleted: Range<usize>, inserted: Vec<PreparedElement>, track_as_changed: bool, )
Applies one child-list splice and updates tracked structural path.
Sourcefn replace_root(&mut self, replacement: PreparedElement, track_as_changed: bool)
fn replace_root(&mut self, replacement: PreparedElement, track_as_changed: bool)
Replaces the tree’s root with a prepared node payload.
Auto Trait Implementations§
impl !RefUnwindSafe for TreeState
impl !Send for TreeState
impl !Sync for TreeState
impl !UnwindSafe for TreeState
impl Freeze for TreeState
impl Unpin for TreeState
impl UnsafeUnpin for TreeState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more