From 0527e3b283af0153cf13fa64fe73862a5b7655c8 Mon Sep 17 00:00:00 2001 From: Bernardo Date: Tue, 11 Dec 2018 19:07:17 +0100 Subject: rename Edit to TextEdit and AtomEdit to AtomTextEdit --- .../tests/data/parser/fuzz-failures/0000.rs | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'crates/ra_syntax/tests/data') diff --git a/crates/ra_syntax/tests/data/parser/fuzz-failures/0000.rs b/crates/ra_syntax/tests/data/parser/fuzz-failures/0000.rs index 53c93d9e9..59cd11495 100644 --- a/crates/ra_syntax/tests/data/parser/fuzz-failures/0000.rs +++ b/crates/ra_syntax/tests/data/parser/fuzz-failures/0000.rs @@ -10,10 +10,10 @@ ); File::new(green, errors) } - pub fn reparse(&self, edit: &AtomEdit) -> File { + pub fn reparse(&self, edit: &AtomTextEdit) -> File { self.incremental_reparse(edit).unwrap_or_else(|| self.full_reparse(edit)) } - pub fn incremental_reparse(&self, edit: &AtomEdit) -> Option { + pub fn incremental_reparse(&self, edit: &AtomTextEdit) -> Option { let (node, reparser) = find_reparsable_node(self.syntax(), edit.delete)?; let text = replace_range( node.text().to_string(), @@ -31,7 +31,7 @@ let errors = merge_errors(self.errors(), new_errors, node, edit); Some(File::new(green_root, errors)) } - fn full_reparse(&self, edit: &AtomEdit) -> File { + fn full_reparse(&self, edit: &AtomTextEdit) -> File { let text = replace_range(self.syntax().text().to_string(), edit.delete, &edit.insert); File::parse(&text) } @@ -58,22 +58,22 @@ } #[derive(Debug, Clone)] -pub struct AtomEdit { +pub struct AtomTextEdit { pub delete: TextRange, pub insert: String, } -impl AtomEdit { - pub fn replace(range: TextRange, replace_with: String) -> AtomEdit { - AtomEdit { delete: range, insert: replace_with } +impl AtomTextEdit { + pub fn replace(range: TextRange, replace_with: String) -> AtomTextEdit { + AtomTextEdit { delete: range, insert: replace_with } } - pub fn delete(range: TextRange) -> AtomEdit { - AtomEdit::replace(range, String::new()) + pub fn delete(range: TextRange) -> AtomTextEdit { + AtomTextEdit::replace(range, String::new()) } - pub fn insert(offset: TextUnit, text: String) -> AtomEdit { - AtomEdit::replace(TextRange::offset_len(offset, 0.into()), text) + pub fn insert(offset: TextUnit, text: String) -> AtomTextEdit { + AtomTextEdit::replace(TextRange::offset_len(offset, 0.into()), text) } } @@ -114,17 +114,17 @@ fn is_balanced(tokens: &[Token]) -> bool { pub insert: String, } -impl AtomEdit { - pub fn replace(range: TextRange, replace_with: String) -> AtomEdit { - AtomEdit { delete: range, insert: replace_with } +impl AtomTextEdit { + pub fn replace(range: TextRange, replace_with: String) -> AtomTextEdit { + AtomTextEdit { delete: range, insert: replace_with } } - pub fn delete(range: TextRange) -> AtomEdit { - AtomEdit::replace(range, String::new()) + pub fn delete(range: TextRange) -> AtomTextEdit { + AtomTextEdit::replace(range, String::new()) } - pub fn insert(offset: TextUnit, text: String) -> AtomEdit { - AtomEdit::replace(TextRange::offset_len(offset, 0.into()), text) + pub fn insert(offset: TextUnit, text: String) -> AtomTextEdit { + AtomTextEdit::replace(TextRange::offset_len(offset, 0.into()), text) } } @@ -176,7 +176,7 @@ fn merge_errors( old_errors: Vec, new_errors: Vec, old_node: SyntaxNodeRef, - edit: &AtomEdit, + edit: &AtomTextEdit, ) -> Vec { let mut res = Vec::new(); for e in old_errors { -- cgit v1.2.3