diff options
author | Lukas Wirth <[email protected]> | 2021-05-30 15:41:33 +0100 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-05-31 14:14:56 +0100 |
commit | fb7105a5801ab1d0ede830cd53bbc3ccbf0b5e2c (patch) | |
tree | 958c7a8548dcc6cfce25ace53476183d73b1460d /crates/rust-analyzer/src | |
parent | 4507382f2e66cd0e6498228bfdffb16769063b0f (diff) |
Add config setting for self-on-the-fly
Diffstat (limited to 'crates/rust-analyzer/src')
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/src/integrated_benchmarks.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 1 |
3 files changed, 7 insertions, 0 deletions
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! { | |||
100 | /// Toggles the additional completions that automatically add imports when completed. | 100 | /// Toggles the additional completions that automatically add imports when completed. |
101 | /// Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled. | 101 | /// Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled. |
102 | completion_autoimport_enable: bool = "true", | 102 | completion_autoimport_enable: bool = "true", |
103 | /// Toggles the additional completions that automatically show method calls and field accesses | ||
104 | /// with `self` prefixed to them when inside a method. | ||
105 | completion_autoself_enable: bool = "true", | ||
103 | 106 | ||
104 | /// Whether to show native rust-analyzer diagnostics. | 107 | /// Whether to show native rust-analyzer diagnostics. |
105 | diagnostics_enable: bool = "true", | 108 | diagnostics_enable: bool = "true", |
@@ -666,6 +669,7 @@ impl Config { | |||
666 | enable_postfix_completions: self.data.completion_postfix_enable, | 669 | enable_postfix_completions: self.data.completion_postfix_enable, |
667 | enable_imports_on_the_fly: self.data.completion_autoimport_enable | 670 | enable_imports_on_the_fly: self.data.completion_autoimport_enable |
668 | && completion_item_edit_resolve(&self.caps), | 671 | && completion_item_edit_resolve(&self.caps), |
672 | enable_self_on_the_fly: self.data.completion_autoself_enable, | ||
669 | add_call_parenthesis: self.data.completion_addCallParenthesis, | 673 | add_call_parenthesis: self.data.completion_addCallParenthesis, |
670 | add_call_argument_snippets: self.data.completion_addCallArgumentSnippets, | 674 | add_call_argument_snippets: self.data.completion_addCallArgumentSnippets, |
671 | insert_use: self.insert_use_config(), | 675 | 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() { | |||
132 | let config = CompletionConfig { | 132 | let config = CompletionConfig { |
133 | enable_postfix_completions: true, | 133 | enable_postfix_completions: true, |
134 | enable_imports_on_the_fly: true, | 134 | enable_imports_on_the_fly: true, |
135 | enable_self_on_the_fly: true, | ||
135 | add_call_parenthesis: true, | 136 | add_call_parenthesis: true, |
136 | add_call_argument_snippets: true, | 137 | add_call_argument_snippets: true, |
137 | snippet_cap: SnippetCap::new(true), | 138 | snippet_cap: SnippetCap::new(true), |
@@ -166,6 +167,7 @@ fn integrated_completion_benchmark() { | |||
166 | let config = CompletionConfig { | 167 | let config = CompletionConfig { |
167 | enable_postfix_completions: true, | 168 | enable_postfix_completions: true, |
168 | enable_imports_on_the_fly: true, | 169 | enable_imports_on_the_fly: true, |
170 | enable_self_on_the_fly: true, | ||
169 | add_call_parenthesis: true, | 171 | add_call_parenthesis: true, |
170 | add_call_argument_snippets: true, | 172 | add_call_argument_snippets: true, |
171 | snippet_cap: SnippetCap::new(true), | 173 | 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 { | |||
1178 | &ide::CompletionConfig { | 1178 | &ide::CompletionConfig { |
1179 | enable_postfix_completions: true, | 1179 | enable_postfix_completions: true, |
1180 | enable_imports_on_the_fly: true, | 1180 | enable_imports_on_the_fly: true, |
1181 | enable_self_on_the_fly: true, | ||
1181 | add_call_parenthesis: true, | 1182 | add_call_parenthesis: true, |
1182 | add_call_argument_snippets: true, | 1183 | add_call_argument_snippets: true, |
1183 | snippet_cap: SnippetCap::new(true), | 1184 | snippet_cap: SnippetCap::new(true), |