aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/syntax/src')
-rw-r--r--crates/syntax/src/ted.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/syntax/src/ted.rs b/crates/syntax/src/ted.rs
index 91a06101f..a50c0dbca 100644
--- a/crates/syntax/src/ted.rs
+++ b/crates/syntax/src/ted.rs
@@ -125,8 +125,11 @@ pub fn remove_all_iter(range: impl IntoIterator<Item = SyntaxElement>) {
125} 125}
126 126
127pub fn replace(old: impl Element, new: impl Element) { 127pub fn replace(old: impl Element, new: impl Element) {
128 replace_with_many(old, vec![new.syntax_element()])
129}
130pub fn replace_with_many(old: impl Element, new: Vec<SyntaxElement>) {
128 let old = old.syntax_element(); 131 let old = old.syntax_element();
129 replace_all(old.clone()..=old, vec![new.syntax_element()]) 132 replace_all(old.clone()..=old, new)
130} 133}
131pub fn replace_all(range: RangeInclusive<SyntaxElement>, new: Vec<SyntaxElement>) { 134pub fn replace_all(range: RangeInclusive<SyntaxElement>, new: Vec<SyntaxElement>) {
132 let start = range.start().index(); 135 let start = range.start().index();