Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/syntax_editor.rs')
| -rw-r--r-- | crates/syntax/src/syntax_editor.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/syntax/src/syntax_editor.rs b/crates/syntax/src/syntax_editor.rs index 6bad93ebf8..7d15195c6f 100644 --- a/crates/syntax/src/syntax_editor.rs +++ b/crates/syntax/src/syntax_editor.rs @@ -203,6 +203,14 @@ impl SyntaxEditor { pub fn finish(self) -> SyntaxEdit { edit_algo::apply_edits(self) } + + pub fn deleted(&self, element: impl Element) -> bool { + let element = element.syntax_element(); + self.changes + .borrow() + .iter() + .any(|change| matches!(change, Change::Replace(existing, None) if *existing == element)) + } } /// Represents a completed [`SyntaxEditor`] operation. |