From bf582e77d6e5603149b355a5650cd4d15318f776 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 10 Mar 2020 18:47:09 +0100 Subject: Pull completion options up to the rust-analyzer --- crates/ra_ide/src/completion/presentation.rs | 5 +---- crates/ra_ide/src/lib.rs | 17 ++++++----------- 2 files changed, 7 insertions(+), 15 deletions(-) (limited to 'crates/ra_ide/src') diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs index 25aff329e..3dc56e4a3 100644 --- a/crates/ra_ide/src/completion/presentation.rs +++ b/crates/ra_ide/src/completion/presentation.rs @@ -104,10 +104,7 @@ impl Completions { }; // Add `<>` for generic types - if ctx.is_path_type - && !ctx.has_type_args - && ctx.db.feature_flags.get("completion.insertion.add-call-parenthesis") - { + if ctx.is_path_type && !ctx.has_type_args && ctx.options.add_call_parenthesis { let has_non_default_type_params = match resolution { ScopeDef::ModuleDef(Adt(it)) => it.has_non_default_type_params(ctx.db), ScopeDef::ModuleDef(TypeAlias(it)) => it.has_non_default_type_params(ctx.db), diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 0d91ea749..d888bb745 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs @@ -450,17 +450,12 @@ impl Analysis { } /// Computes completions at the given position. - pub fn completions(&self, position: FilePosition) -> Cancelable>> { - let opts = CompletionOptions { - enable_postfix_completions: self.feature_flags().get("completion.enable-postfix"), - add_call_parenthesis: self - .feature_flags() - .get("completion.insertion.add-call-parenthesis"), - add_call_argument_snippets: self - .feature_flags() - .get("completion.insertion.add-argument-snippets"), - }; - self.with_db(|db| completion::completions(db, position, &opts).map(Into::into)) + pub fn completions( + &self, + position: FilePosition, + options: &CompletionOptions, + ) -> Cancelable>> { + self.with_db(|db| completion::completions(db, position, options).map(Into::into)) } /// Computes assists (aka code actions aka intentions) for the given -- cgit v1.2.3