aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-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
-rw-r--r--crates/rust-analyzer/src/caps.rs1
-rw-r--r--crates/rust-analyzer/src/config.rs6
5 files changed, 13 insertions, 13 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///
diff --git a/crates/rust-analyzer/src/caps.rs b/crates/rust-analyzer/src/caps.rs
index 1e0ee10e4..5e4c22bc5 100644
--- a/crates/rust-analyzer/src/caps.rs
+++ b/crates/rust-analyzer/src/caps.rs
@@ -97,6 +97,7 @@ pub fn server_capabilities(client_caps: &ClientCapabilities) -> ServerCapabiliti
97 97
98fn completions_resolve_provider(client_caps: &ClientCapabilities) -> Option<bool> { 98fn completions_resolve_provider(client_caps: &ClientCapabilities) -> Option<bool> {
99 if enabled_completions_resolve_capabilities(client_caps)?.is_empty() { 99 if enabled_completions_resolve_capabilities(client_caps)?.is_empty() {
100 log::info!("No `additionalTextEdits` completion resolve capability was found in the client capabilities, autoimport completion is disabled");
100 None 101 None
101 } else { 102 } else {
102 Some(true) 103 Some(true)
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index f46aa2dd4..5243b50c8 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -182,7 +182,7 @@ impl Config {
182 }, 182 },
183 completion: CompletionConfig { 183 completion: CompletionConfig {
184 enable_postfix_completions: true, 184 enable_postfix_completions: true,
185 disable_fuzzy_autoimports: false, 185 enable_autoimport_completions: true,
186 add_call_parenthesis: true, 186 add_call_parenthesis: true,
187 add_call_argument_snippets: true, 187 add_call_argument_snippets: true,
188 ..CompletionConfig::default() 188 ..CompletionConfig::default()
@@ -305,7 +305,7 @@ impl Config {
305 }; 305 };
306 306
307 self.completion.enable_postfix_completions = data.completion_postfix_enable; 307 self.completion.enable_postfix_completions = data.completion_postfix_enable;
308 self.completion.disable_fuzzy_autoimports = data.completion_disableFuzzyAutoimports; 308 self.completion.enable_autoimport_completions = data.completion_autoimport_enable;
309 self.completion.add_call_parenthesis = data.completion_addCallParenthesis; 309 self.completion.add_call_parenthesis = data.completion_addCallParenthesis;
310 self.completion.add_call_argument_snippets = data.completion_addCallArgumentSnippets; 310 self.completion.add_call_argument_snippets = data.completion_addCallArgumentSnippets;
311 self.completion.merge = self.assist.insert_use.merge; 311 self.completion.merge = self.assist.insert_use.merge;
@@ -508,7 +508,7 @@ config_data! {
508 completion_addCallArgumentSnippets: bool = true, 508 completion_addCallArgumentSnippets: bool = true,
509 completion_addCallParenthesis: bool = true, 509 completion_addCallParenthesis: bool = true,
510 completion_postfix_enable: bool = true, 510 completion_postfix_enable: bool = true,
511 completion_disableFuzzyAutoimports: bool = false, 511 completion_autoimport_enable: bool = true,
512 512
513 diagnostics_enable: bool = true, 513 diagnostics_enable: bool = true,
514 diagnostics_enableExperimental: bool = true, 514 diagnostics_enableExperimental: bool = true,