From a4635a199bc446bd103aa5821e57dc19b8a15751 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 3 Jan 2019 18:59:17 +0300 Subject: more enterprisey assists API --- crates/ra_analysis/src/imp.rs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'crates/ra_analysis') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 136e7f7dc..771dad475 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -333,19 +333,9 @@ impl db::RootDatabase { pub(crate) fn assists(&self, frange: FileRange) -> Vec { let file = self.source_file(frange.file_id); - let offset = frange.range.start(); - let actions = vec![ - assists::flip_comma(&file, offset).map(|f| f()), - assists::add_derive(&file, offset).map(|f| f()), - assists::add_impl(&file, offset).map(|f| f()), - assists::change_visibility(&file, offset).map(|f| f()), - assists::introduce_variable(&file, frange.range).map(|f| f()), - ]; - actions + assists::assists(&file, frange.range) .into_iter() - .filter_map(|local_edit| { - Some(SourceChange::from_local_edit(frange.file_id, local_edit?)) - }) + .map(|local_edit| SourceChange::from_local_edit(frange.file_id, local_edit)) .collect() } @@ -440,7 +430,7 @@ impl db::RootDatabase { .map(|(file_id, text_range)| SourceFileEdit { file_id: *file_id, edit: { - let mut builder = ra_text_edit::TextEditBuilder::new(); + let mut builder = ra_text_edit::TextEditBuilder::default(); builder.replace(*text_range, new_name.into()); builder.finish() }, -- cgit v1.2.3 From 6be39ba758eade2a20ab6384127a2b1ca48ca9ce Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 3 Jan 2019 19:06:51 +0300 Subject: fix the test --- crates/ra_analysis/tests/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_analysis') diff --git a/crates/ra_analysis/tests/tests.rs b/crates/ra_analysis/tests/tests.rs index bcf29d29c..c2ef87b54 100644 --- a/crates/ra_analysis/tests/tests.rs +++ b/crates/ra_analysis/tests/tests.rs @@ -531,7 +531,7 @@ fn test_rename_for_mut_param() { fn test_rename(text: &str, new_name: &str, expected: &str) { let (analysis, position) = single_file_with_position(text); let edits = analysis.rename(position, new_name).unwrap(); - let mut text_edit_bulder = ra_text_edit::TextEditBuilder::new(); + let mut text_edit_bulder = ra_text_edit::TextEditBuilder::default(); let mut file_id: Option = None; for edit in edits { file_id = Some(edit.file_id); -- cgit v1.2.3