aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-03-10 17:47:09 +0000
committerAleksey Kladov <[email protected]>2020-03-10 17:47:09 +0000
commitbf582e77d6e5603149b355a5650cd4d15318f776 (patch)
treefd655f5e42cd720e11c067c43449f7bcf6311ccd /crates/ra_ide/src
parent2347c03dcd717fbc0648c1e4e3d64a886217de5d (diff)
Pull completion options up to the rust-analyzer
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/completion/presentation.rs5
-rw-r--r--crates/ra_ide/src/lib.rs17
2 files changed, 7 insertions, 15 deletions
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 {
104 }; 104 };
105 105
106 // Add `<>` for generic types 106 // Add `<>` for generic types
107 if ctx.is_path_type 107 if ctx.is_path_type && !ctx.has_type_args && ctx.options.add_call_parenthesis {
108 && !ctx.has_type_args
109 && ctx.db.feature_flags.get("completion.insertion.add-call-parenthesis")
110 {
111 let has_non_default_type_params = match resolution { 108 let has_non_default_type_params = match resolution {
112 ScopeDef::ModuleDef(Adt(it)) => it.has_non_default_type_params(ctx.db), 109 ScopeDef::ModuleDef(Adt(it)) => it.has_non_default_type_params(ctx.db),
113 ScopeDef::ModuleDef(TypeAlias(it)) => it.has_non_default_type_params(ctx.db), 110 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 {
450 } 450 }
451 451
452 /// Computes completions at the given position. 452 /// Computes completions at the given position.
453 pub fn completions(&self, position: FilePosition) -> Cancelable<Option<Vec<CompletionItem>>> { 453 pub fn completions(
454 let opts = CompletionOptions { 454 &self,
455 enable_postfix_completions: self.feature_flags().get("completion.enable-postfix"), 455 position: FilePosition,
456 add_call_parenthesis: self 456 options: &CompletionOptions,
457 .feature_flags() 457 ) -> Cancelable<Option<Vec<CompletionItem>>> {
458 .get("completion.insertion.add-call-parenthesis"), 458 self.with_db(|db| completion::completions(db, position, options).map(Into::into))
459 add_call_argument_snippets: self
460 .feature_flags()
461 .get("completion.insertion.add-argument-snippets"),
462 };
463 self.with_db(|db| completion::completions(db, position, &opts).map(Into::into))
464 } 459 }
465 460
466 /// Computes assists (aka code actions aka intentions) for the given 461 /// Computes assists (aka code actions aka intentions) for the given