From c847c079fd66d7ed09c64ff398baf05317b16500 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 17 May 2020 12:09:53 +0200 Subject: Add AssistConfig --- crates/ra_ide/src/completion.rs | 2 +- crates/ra_ide/src/completion/test_utils.rs | 2 +- crates/ra_ide/src/diagnostics.rs | 2 ++ crates/ra_ide/src/lib.rs | 10 +++++----- crates/ra_ide/src/references/rename.rs | 3 +++ 5 files changed, 12 insertions(+), 7 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/completion.rs b/crates/ra_ide/src/completion.rs index 8bdc43b1a..191300704 100644 --- a/crates/ra_ide/src/completion.rs +++ b/crates/ra_ide/src/completion.rs @@ -59,8 +59,8 @@ pub use crate::completion::{ /// with ordering of completions (currently this is done by the client). pub(crate) fn completions( db: &RootDatabase, - position: FilePosition, config: &CompletionConfig, + position: FilePosition, ) -> Option { let ctx = CompletionContext::new(db, position, config)?; diff --git a/crates/ra_ide/src/completion/test_utils.rs b/crates/ra_ide/src/completion/test_utils.rs index eb90b5279..bf22452a2 100644 --- a/crates/ra_ide/src/completion/test_utils.rs +++ b/crates/ra_ide/src/completion/test_utils.rs @@ -20,7 +20,7 @@ pub(crate) fn do_completion_with_options( } else { single_file_with_position(code) }; - let completions = analysis.completions(position, options).unwrap().unwrap(); + let completions = analysis.completions(options, position).unwrap().unwrap(); let completion_items: Vec = completions.into(); let mut kind_completions: Vec = completion_items.into_iter().filter(|c| c.completion_kind == kind).collect(); diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index 87a0b80f1..54c2bcc09 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs @@ -629,6 +629,7 @@ mod tests { }, ], cursor_position: None, + is_snippet: false, }, ), severity: Error, @@ -685,6 +686,7 @@ mod tests { ], file_system_edits: [], cursor_position: None, + is_snippet: false, }, ), severity: Error, diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 78149ddfc..66125f2f5 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs @@ -82,7 +82,7 @@ pub use crate::{ }; pub use hir::Documentation; -pub use ra_assists::AssistId; +pub use ra_assists::{AssistConfig, AssistId}; pub use ra_db::{ Canceled, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRootId, }; @@ -458,17 +458,17 @@ impl Analysis { /// Computes completions at the given position. pub fn completions( &self, - position: FilePosition, config: &CompletionConfig, + position: FilePosition, ) -> Cancelable>> { - self.with_db(|db| completion::completions(db, position, config).map(Into::into)) + self.with_db(|db| completion::completions(db, config, position).map(Into::into)) } /// Computes assists (aka code actions aka intentions) for the given /// position. - pub fn assists(&self, frange: FileRange) -> Cancelable> { + pub fn assists(&self, config: &AssistConfig, frange: FileRange) -> Cancelable> { self.with_db(|db| { - ra_assists::Assist::resolved(db, frange) + ra_assists::Assist::resolved(db, config, frange) .into_iter() .map(|assist| Assist { id: assist.assist.id, diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 410dae75c..68a53ad4b 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs @@ -670,6 +670,7 @@ mod tests { }, ], cursor_position: None, + is_snippet: false, }, }, ) @@ -722,6 +723,7 @@ mod tests { }, ], cursor_position: None, + is_snippet: false, }, }, ) @@ -818,6 +820,7 @@ mod tests { }, ], cursor_position: None, + is_snippet: false, }, }, ) -- cgit v1.2.3