Add config setting for self-on-the-fly

This commit is contained in:
Lukas Wirth 2021-05-30 16:41:33 +02:00
parent 4507382f2e
commit fb7105a580
10 changed files with 27 additions and 2 deletions

View file

@ -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(),

View file

@ -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),

View file

@ -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),