From cbd3717f2c52b17aa9b15c2df4a364c62d17e4e1 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 8 Dec 2020 14:27:18 +0200 Subject: Better config name --- crates/completion/src/completions/unqualified_path.rs | 6 ++++-- crates/completion/src/config.rs | 4 ++-- crates/completion/src/lib.rs | 9 +++------ 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'crates/completion') diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs index 2a315cb86..f65709adf 100644 --- a/crates/completion/src/completions/unqualified_path.rs +++ b/crates/completion/src/completions/unqualified_path.rs @@ -44,7 +44,7 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC acc.add_resolution(ctx, name.to_string(), &res) }); - if !ctx.config.disable_fuzzy_autoimports && ctx.config.resolve_additional_edits_lazily() { + if ctx.config.enable_autoimport_completions && ctx.config.resolve_additional_edits_lazily() { fuzzy_completion(acc, ctx).unwrap_or_default() } } @@ -116,7 +116,9 @@ fn complete_enum_variants(acc: &mut Completions, ctx: &CompletionContext, ty: &T // // .Feature toggle // -// The feature can be forcefully turned off in the settings with the `rust-analyzer.completion.disableFuzzyAutoimports` flag. +// The feature can be forcefully turned off in the settings with the `rust-analyzer.completion.enableAutoimportCompletions` flag. +// Note that having this flag set to `true` does not guarantee that the feature is enabled: your client needs to have the corredponding +// capability enabled. fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { let _p = profile::span("fuzzy_completion"); let potential_import_name = ctx.token.to_string(); diff --git a/crates/completion/src/config.rs b/crates/completion/src/config.rs index 8082ec9cb..5175b9d69 100644 --- a/crates/completion/src/config.rs +++ b/crates/completion/src/config.rs @@ -10,7 +10,7 @@ use rustc_hash::FxHashSet; #[derive(Clone, Debug, PartialEq, Eq)] pub struct CompletionConfig { pub enable_postfix_completions: bool, - pub disable_fuzzy_autoimports: bool, + pub enable_autoimport_completions: bool, pub add_call_parenthesis: bool, pub add_call_argument_snippets: bool, pub snippet_cap: Option, @@ -52,7 +52,7 @@ impl Default for CompletionConfig { fn default() -> Self { CompletionConfig { enable_postfix_completions: true, - disable_fuzzy_autoimports: false, + enable_autoimport_completions: true, add_call_parenthesis: true, add_call_argument_snippets: true, snippet_cap: Some(SnippetCap { _private: () }), diff --git a/crates/completion/src/lib.rs b/crates/completion/src/lib.rs index 8df9f00fe..f60f87243 100644 --- a/crates/completion/src/lib.rs +++ b/crates/completion/src/lib.rs @@ -73,12 +73,9 @@ pub use crate::{ // } // ``` // -// And experimental completions, enabled with the `rust-analyzer.completion.disableFuzzyAutoimports` setting. -// This flag enables or disables: -// -// - Auto import: additional completion options with automatic `use` import and options from all project importable items, matched for the input -// -// Experimental completions might cause issues with performance and completion list look. +// And the auto import completions, enabled with the `rust-analyzer.completion.autoimport.enable` setting and the corresponding LSP client capabilities. +// Those are the additional completion options with automatic `use` import and options from all project importable items, +// fuzzy matched agains the completion imput. /// Main entry point for completion. We run completion as a two-phase process. /// -- cgit v1.2.3