Gate autoimports begind experimental completions flag

This commit is contained in:
Kirill Bulatov 2020-11-25 00:02:45 +02:00
parent 5478aaebfe
commit 4c95c6e25d
4 changed files with 13 additions and 1 deletions

View file

@ -44,7 +44,9 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC
acc.add_resolution(ctx, name.to_string(), &res)
});
fuzzy_completion(acc, ctx).unwrap_or_default()
if ctx.config.enable_experimental_completions {
fuzzy_completion(acc, ctx).unwrap_or_default()
}
}
fn complete_enum_variants(acc: &mut Completions, ctx: &CompletionContext, ty: &Type) {

View file

@ -9,6 +9,7 @@ use assists::utils::MergeBehaviour;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CompletionConfig {
pub enable_postfix_completions: bool,
pub enable_experimental_completions: bool,
pub add_call_parenthesis: bool,
pub add_call_argument_snippets: bool,
pub snippet_cap: Option<SnippetCap>,
@ -30,6 +31,7 @@ impl Default for CompletionConfig {
fn default() -> Self {
CompletionConfig {
enable_postfix_completions: true,
enable_experimental_completions: true,
add_call_parenthesis: true,
add_call_argument_snippets: true,
snippet_cap: Some(SnippetCap { _private: () }),

View file

@ -184,6 +184,7 @@ impl Config {
},
completion: CompletionConfig {
enable_postfix_completions: true,
enable_experimental_completions: true,
add_call_parenthesis: true,
add_call_argument_snippets: true,
..CompletionConfig::default()
@ -306,6 +307,7 @@ impl Config {
};
self.completion.enable_postfix_completions = data.completion_postfix_enable;
self.completion.enable_experimental_completions = data.completion_enableExperimental;
self.completion.add_call_parenthesis = data.completion_addCallParenthesis;
self.completion.add_call_argument_snippets = data.completion_addCallArgumentSnippets;
self.completion.merge = self.assist.insert_use.merge;
@ -506,6 +508,7 @@ config_data! {
completion_addCallArgumentSnippets: bool = true,
completion_addCallParenthesis: bool = true,
completion_postfix_enable: bool = true,
completion_enableExperimental: bool = true,
diagnostics_enable: bool = true,
diagnostics_enableExperimental: bool = true,

View file

@ -460,6 +460,11 @@
"default": true,
"markdownDescription": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc."
},
"rust-analyzer.completion.enableExperimental": {
"type": "boolean",
"default": true,
"markdownDescription": "Display additional completions with potential false positives and performance issues"
},
"rust-analyzer.callInfo.full": {
"type": "boolean",
"default": true,