aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/imp.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-03 15:59:17 +0000
committerAleksey Kladov <[email protected]>2019-01-03 15:59:17 +0000
commita4635a199bc446bd103aa5821e57dc19b8a15751 (patch)
tree5dcdd940d8627f021062245cb79589a790b60e04 /crates/ra_analysis/src/imp.rs
parentaea2183799e7975d3d9000cec9bb9a3c001a3d4e (diff)
more enterprisey assists API
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r--crates/ra_analysis/src/imp.rs16
1 files changed, 3 insertions, 13 deletions
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 {
333 333
334 pub(crate) fn assists(&self, frange: FileRange) -> Vec<SourceChange> { 334 pub(crate) fn assists(&self, frange: FileRange) -> Vec<SourceChange> {
335 let file = self.source_file(frange.file_id); 335 let file = self.source_file(frange.file_id);
336 let offset = frange.range.start(); 336 assists::assists(&file, frange.range)
337 let actions = vec![
338 assists::flip_comma(&file, offset).map(|f| f()),
339 assists::add_derive(&file, offset).map(|f| f()),
340 assists::add_impl(&file, offset).map(|f| f()),
341 assists::change_visibility(&file, offset).map(|f| f()),
342 assists::introduce_variable(&file, frange.range).map(|f| f()),
343 ];
344 actions
345 .into_iter() 337 .into_iter()
346 .filter_map(|local_edit| { 338 .map(|local_edit| SourceChange::from_local_edit(frange.file_id, local_edit))
347 Some(SourceChange::from_local_edit(frange.file_id, local_edit?))
348 })
349 .collect() 339 .collect()
350 } 340 }
351 341
@@ -440,7 +430,7 @@ impl db::RootDatabase {
440 .map(|(file_id, text_range)| SourceFileEdit { 430 .map(|(file_id, text_range)| SourceFileEdit {
441 file_id: *file_id, 431 file_id: *file_id,
442 edit: { 432 edit: {
443 let mut builder = ra_text_edit::TextEditBuilder::new(); 433 let mut builder = ra_text_edit::TextEditBuilder::default();
444 builder.replace(*text_range, new_name.into()); 434 builder.replace(*text_range, new_name.into());
445 builder.finish() 435 builder.finish()
446 }, 436 },