Skip to content

Commit 4c95c6e

Browse files
Gate autoimports begind experimental completions flag
1 parent 5478aae commit 4c95c6e

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

crates/completion/src/completions/unqualified_path.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC
4444
acc.add_resolution(ctx, name.to_string(), &res)
4545
});
4646

47-
fuzzy_completion(acc, ctx).unwrap_or_default()
47+
if ctx.config.enable_experimental_completions {
48+
fuzzy_completion(acc, ctx).unwrap_or_default()
49+
}
4850
}
4951

5052
fn complete_enum_variants(acc: &mut Completions, ctx: &CompletionContext, ty: &Type) {

crates/completion/src/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use assists::utils::MergeBehaviour;
99
#[derive(Clone, Debug, PartialEq, Eq)]
1010
pub struct CompletionConfig {
1111
pub enable_postfix_completions: bool,
12+
pub enable_experimental_completions: bool,
1213
pub add_call_parenthesis: bool,
1314
pub add_call_argument_snippets: bool,
1415
pub snippet_cap: Option<SnippetCap>,
@@ -30,6 +31,7 @@ impl Default for CompletionConfig {
3031
fn default() -> Self {
3132
CompletionConfig {
3233
enable_postfix_completions: true,
34+
enable_experimental_completions: true,
3335
add_call_parenthesis: true,
3436
add_call_argument_snippets: true,
3537
snippet_cap: Some(SnippetCap { _private: () }),

crates/rust-analyzer/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ impl Config {
184184
},
185185
completion: CompletionConfig {
186186
enable_postfix_completions: true,
187+
enable_experimental_completions: true,
187188
add_call_parenthesis: true,
188189
add_call_argument_snippets: true,
189190
..CompletionConfig::default()
@@ -306,6 +307,7 @@ impl Config {
306307
};
307308

308309
self.completion.enable_postfix_completions = data.completion_postfix_enable;
310+
self.completion.enable_experimental_completions = data.completion_enableExperimental;
309311
self.completion.add_call_parenthesis = data.completion_addCallParenthesis;
310312
self.completion.add_call_argument_snippets = data.completion_addCallArgumentSnippets;
311313
self.completion.merge = self.assist.insert_use.merge;
@@ -506,6 +508,7 @@ config_data! {
506508
completion_addCallArgumentSnippets: bool = true,
507509
completion_addCallParenthesis: bool = true,
508510
completion_postfix_enable: bool = true,
511+
completion_enableExperimental: bool = true,
509512

510513
diagnostics_enable: bool = true,
511514
diagnostics_enableExperimental: bool = true,

editors/code/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,11 @@
460460
"default": true,
461461
"markdownDescription": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc."
462462
},
463+
"rust-analyzer.completion.enableExperimental": {
464+
"type": "boolean",
465+
"default": true,
466+
"markdownDescription": "Display additional completions with potential false positives and performance issues"
467+
},
463468
"rust-analyzer.callInfo.full": {
464469
"type": "boolean",
465470
"default": true,

0 commit comments

Comments
 (0)