From 4a6fa8f0dfcebbb4ea80394e5e4ca21f076f58f2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 5 May 2020 23:15:49 +0200 Subject: Rename AtomTextEdit -> Indel --- crates/ra_syntax/src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'crates/ra_syntax/src/lib.rs') diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index d0234cada..1a7348dac 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs @@ -39,7 +39,7 @@ pub mod fuzz; use std::{marker::PhantomData, sync::Arc}; -use ra_text_edit::AtomTextEdit; +use ra_text_edit::Indel; use stdx::format_to; use crate::syntax_node::GreenNode; @@ -126,13 +126,13 @@ impl Parse { buf } - pub fn reparse(&self, edit: &AtomTextEdit) -> Parse { - self.incremental_reparse(edit).unwrap_or_else(|| self.full_reparse(edit)) + pub fn reparse(&self, indel: &Indel) -> Parse { + self.incremental_reparse(indel).unwrap_or_else(|| self.full_reparse(indel)) } - fn incremental_reparse(&self, edit: &AtomTextEdit) -> Option> { + fn incremental_reparse(&self, indel: &Indel) -> Option> { // FIXME: validation errors are not handled here - parsing::incremental_reparse(self.tree().syntax(), edit, self.errors.to_vec()).map( + parsing::incremental_reparse(self.tree().syntax(), indel, self.errors.to_vec()).map( |(green_node, errors, _reparsed_range)| Parse { green: green_node, errors: Arc::new(errors), @@ -141,8 +141,8 @@ impl Parse { ) } - fn full_reparse(&self, edit: &AtomTextEdit) -> Parse { - let text = edit.apply(self.tree().syntax().text().to_string()); + fn full_reparse(&self, indel: &Indel) -> Parse { + let text = indel.apply(self.tree().syntax().text().to_string()); SourceFile::parse(&text) } } -- cgit v1.2.3 From 27c7ef6d65ffa6a642768377d3f0ba85ac8564bf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 5 May 2020 23:23:29 +0200 Subject: Use more natural signature for Edit::apply --- crates/ra_syntax/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/lib.rs') diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index 1a7348dac..61e686da5 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs @@ -142,7 +142,8 @@ impl Parse { } fn full_reparse(&self, indel: &Indel) -> Parse { - let text = indel.apply(self.tree().syntax().text().to_string()); + let mut text = self.tree().syntax().text().to_string(); + indel.apply(&mut text); SourceFile::parse(&text) } } -- cgit v1.2.3