aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/completion/src/completions/unqualified_path.rs4
-rw-r--r--crates/completion/src/config.rs2
-rw-r--r--crates/rust-analyzer/src/config.rs3
-rw-r--r--editors/code/package.json5
4 files changed, 13 insertions, 1 deletions
diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs
index 86c143b63..4f1c9faa0 100644
--- a/crates/completion/src/completions/unqualified_path.rs
+++ b/crates/completion/src/completions/unqualified_path.rs
@@ -44,7 +44,9 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC
44 acc.add_resolution(ctx, name.to_string(), &res) 44 acc.add_resolution(ctx, name.to_string(), &res)
45 }); 45 });
46 46
47 fuzzy_completion(acc, ctx).unwrap_or_default() 47 if ctx.config.enable_experimental_completions {
48 fuzzy_completion(acc, ctx).unwrap_or_default()
49 }
48} 50}
49 51
50fn complete_enum_variants(acc: &mut Completions, ctx: &CompletionContext, ty: &Type) { 52fn complete_enum_variants(acc: &mut Completions, ctx: &CompletionContext, ty: &Type) {
diff --git a/crates/completion/src/config.rs b/crates/completion/src/config.rs
index 82874ff25..f50735372 100644
--- a/crates/completion/src/config.rs
+++ b/crates/completion/src/config.rs
@@ -9,6 +9,7 @@ use assists::utils::MergeBehaviour;
9#[derive(Clone, Debug, PartialEq, Eq)] 9#[derive(Clone, Debug, PartialEq, Eq)]
10pub struct CompletionConfig { 10pub struct CompletionConfig {
11 pub enable_postfix_completions: bool, 11 pub enable_postfix_completions: bool,
12 pub enable_experimental_completions: bool,
12 pub add_call_parenthesis: bool, 13 pub add_call_parenthesis: bool,
13 pub add_call_argument_snippets: bool, 14 pub add_call_argument_snippets: bool,
14 pub snippet_cap: Option<SnippetCap>, 15 pub snippet_cap: Option<SnippetCap>,
@@ -30,6 +31,7 @@ impl Default for CompletionConfig {
30 fn default() -> Self { 31 fn default() -> Self {
31 CompletionConfig { 32 CompletionConfig {
32 enable_postfix_completions: true, 33 enable_postfix_completions: true,
34 enable_experimental_completions: true,
33 add_call_parenthesis: true, 35 add_call_parenthesis: true,
34 add_call_argument_snippets: true, 36 add_call_argument_snippets: true,
35 snippet_cap: Some(SnippetCap { _private: () }), 37 snippet_cap: Some(SnippetCap { _private: () }),
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 5fc6800cf..a334cdb11 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -184,6 +184,7 @@ impl Config {
184 }, 184 },
185 completion: CompletionConfig { 185 completion: CompletionConfig {
186 enable_postfix_completions: true, 186 enable_postfix_completions: true,
187 enable_experimental_completions: true,
187 add_call_parenthesis: true, 188 add_call_parenthesis: true,
188 add_call_argument_snippets: true, 189 add_call_argument_snippets: true,
189 ..CompletionConfig::default() 190 ..CompletionConfig::default()
@@ -306,6 +307,7 @@ impl Config {
306 }; 307 };
307 308
308 self.completion.enable_postfix_completions = data.completion_postfix_enable; 309 self.completion.enable_postfix_completions = data.completion_postfix_enable;
310 self.completion.enable_experimental_completions = data.completion_enableExperimental;
309 self.completion.add_call_parenthesis = data.completion_addCallParenthesis; 311 self.completion.add_call_parenthesis = data.completion_addCallParenthesis;
310 self.completion.add_call_argument_snippets = data.completion_addCallArgumentSnippets; 312 self.completion.add_call_argument_snippets = data.completion_addCallArgumentSnippets;
311 self.completion.merge = self.assist.insert_use.merge; 313 self.completion.merge = self.assist.insert_use.merge;
@@ -506,6 +508,7 @@ config_data! {
506 completion_addCallArgumentSnippets: bool = true, 508 completion_addCallArgumentSnippets: bool = true,
507 completion_addCallParenthesis: bool = true, 509 completion_addCallParenthesis: bool = true,
508 completion_postfix_enable: bool = true, 510 completion_postfix_enable: bool = true,
511 completion_enableExperimental: bool = true,
509 512
510 diagnostics_enable: bool = true, 513 diagnostics_enable: bool = true,
511 diagnostics_enableExperimental: bool = true, 514 diagnostics_enableExperimental: bool = true,
diff --git a/editors/code/package.json b/editors/code/package.json
index a2d6b1148..5bf72075f 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -460,6 +460,11 @@
460 "default": true, 460 "default": true,
461 "markdownDescription": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc." 461 "markdownDescription": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc."
462 }, 462 },
463 "rust-analyzer.completion.enableExperimental": {
464 "type": "boolean",
465 "default": true,
466 "markdownDescription": "Display additional completions with potential false positives and performance issues"
467 },
463 "rust-analyzer.callInfo.full": { 468 "rust-analyzer.callInfo.full": {
464 "type": "boolean", 469 "type": "boolean",
465 "default": true, 470 "default": true,