aboutsummaryrefslogtreecommitdiff
path: root/crates/completion
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-12-08 12:27:18 +0000
committerKirill Bulatov <[email protected]>2020-12-08 12:27:18 +0000
commitcbd3717f2c52b17aa9b15c2df4a364c62d17e4e1 (patch)
tree288fb7dea2b2ef504ae6f8d87d8fc74d043625da /crates/completion
parent3183ff3a7b1fbcf3cb5379cf162a3d769a21be7a (diff)
Better config name
Diffstat (limited to 'crates/completion')
-rw-r--r--crates/completion/src/completions/unqualified_path.rs6
-rw-r--r--crates/completion/src/config.rs4
-rw-r--r--crates/completion/src/lib.rs9
3 files changed, 9 insertions, 10 deletions
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
44 acc.add_resolution(ctx, name.to_string(), &res) 44 acc.add_resolution(ctx, name.to_string(), &res)
45 }); 45 });
46 46
47 if !ctx.config.disable_fuzzy_autoimports && ctx.config.resolve_additional_edits_lazily() { 47 if ctx.config.enable_autoimport_completions && ctx.config.resolve_additional_edits_lazily() {
48 fuzzy_completion(acc, ctx).unwrap_or_default() 48 fuzzy_completion(acc, ctx).unwrap_or_default()
49 } 49 }
50} 50}
@@ -116,7 +116,9 @@ fn complete_enum_variants(acc: &mut Completions, ctx: &CompletionContext, ty: &T
116// 116//
117// .Feature toggle 117// .Feature toggle
118// 118//
119// The feature can be forcefully turned off in the settings with the `rust-analyzer.completion.disableFuzzyAutoimports` flag. 119// The feature can be forcefully turned off in the settings with the `rust-analyzer.completion.enableAutoimportCompletions` flag.
120// Note that having this flag set to `true` does not guarantee that the feature is enabled: your client needs to have the corredponding
121// capability enabled.
120fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { 122fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
121 let _p = profile::span("fuzzy_completion"); 123 let _p = profile::span("fuzzy_completion");
122 let potential_import_name = ctx.token.to_string(); 124 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;
10#[derive(Clone, Debug, PartialEq, Eq)] 10#[derive(Clone, Debug, PartialEq, Eq)]
11pub struct CompletionConfig { 11pub struct CompletionConfig {
12 pub enable_postfix_completions: bool, 12 pub enable_postfix_completions: bool,
13 pub disable_fuzzy_autoimports: bool, 13 pub enable_autoimport_completions: bool,
14 pub add_call_parenthesis: bool, 14 pub add_call_parenthesis: bool,
15 pub add_call_argument_snippets: bool, 15 pub add_call_argument_snippets: bool,
16 pub snippet_cap: Option<SnippetCap>, 16 pub snippet_cap: Option<SnippetCap>,
@@ -52,7 +52,7 @@ impl Default for CompletionConfig {
52 fn default() -> Self { 52 fn default() -> Self {
53 CompletionConfig { 53 CompletionConfig {
54 enable_postfix_completions: true, 54 enable_postfix_completions: true,
55 disable_fuzzy_autoimports: false, 55 enable_autoimport_completions: true,
56 add_call_parenthesis: true, 56 add_call_parenthesis: true,
57 add_call_argument_snippets: true, 57 add_call_argument_snippets: true,
58 snippet_cap: Some(SnippetCap { _private: () }), 58 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::{
73// } 73// }
74// ``` 74// ```
75// 75//
76// And experimental completions, enabled with the `rust-analyzer.completion.disableFuzzyAutoimports` setting. 76// And the auto import completions, enabled with the `rust-analyzer.completion.autoimport.enable` setting and the corresponding LSP client capabilities.
77// This flag enables or disables: 77// Those are the additional completion options with automatic `use` import and options from all project importable items,
78// 78// fuzzy matched agains the completion imput.
79// - Auto import: additional completion options with automatic `use` import and options from all project importable items, matched for the input
80//
81// Experimental completions might cause issues with performance and completion list look.
82 79
83/// Main entry point for completion. We run completion as a two-phase process. 80/// Main entry point for completion. We run completion as a two-phase process.
84/// 81///