From fb7105a5801ab1d0ede830cd53bbc3ccbf0b5e2c Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sun, 30 May 2021 16:41:33 +0200 Subject: Add config setting for self-on-the-fly --- crates/rust-analyzer/src/config.rs | 4 ++++ crates/rust-analyzer/src/integrated_benchmarks.rs | 2 ++ crates/rust-analyzer/src/to_proto.rs | 1 + 3 files changed, 7 insertions(+) (limited to 'crates/rust-analyzer/src') diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index a67b0bb25..ae78fd4f6 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -100,6 +100,9 @@ config_data! { /// Toggles the additional completions that automatically add imports when completed. /// Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled. completion_autoimport_enable: bool = "true", + /// Toggles the additional completions that automatically show method calls and field accesses + /// with `self` prefixed to them when inside a method. + completion_autoself_enable: bool = "true", /// Whether to show native rust-analyzer diagnostics. diagnostics_enable: bool = "true", @@ -666,6 +669,7 @@ impl Config { enable_postfix_completions: self.data.completion_postfix_enable, enable_imports_on_the_fly: self.data.completion_autoimport_enable && completion_item_edit_resolve(&self.caps), + enable_self_on_the_fly: self.data.completion_autoself_enable, add_call_parenthesis: self.data.completion_addCallParenthesis, add_call_argument_snippets: self.data.completion_addCallArgumentSnippets, insert_use: self.insert_use_config(), diff --git a/crates/rust-analyzer/src/integrated_benchmarks.rs b/crates/rust-analyzer/src/integrated_benchmarks.rs index 781073fe5..ec36a5f5c 100644 --- a/crates/rust-analyzer/src/integrated_benchmarks.rs +++ b/crates/rust-analyzer/src/integrated_benchmarks.rs @@ -132,6 +132,7 @@ fn integrated_completion_benchmark() { let config = CompletionConfig { enable_postfix_completions: true, enable_imports_on_the_fly: true, + enable_self_on_the_fly: true, add_call_parenthesis: true, add_call_argument_snippets: true, snippet_cap: SnippetCap::new(true), @@ -166,6 +167,7 @@ fn integrated_completion_benchmark() { let config = CompletionConfig { enable_postfix_completions: true, enable_imports_on_the_fly: true, + enable_self_on_the_fly: true, add_call_parenthesis: true, add_call_argument_snippets: true, snippet_cap: SnippetCap::new(true), diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index f5c8535a2..2b2ef2c60 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs @@ -1178,6 +1178,7 @@ mod tests { &ide::CompletionConfig { enable_postfix_completions: true, enable_imports_on_the_fly: true, + enable_self_on_the_fly: true, add_call_parenthesis: true, add_call_argument_snippets: true, snippet_cap: SnippetCap::new(true), -- cgit v1.2.3