Optionally disable term search for autocompletion

This commit is contained in:
Tavo Annus 2024-01-22 20:34:17 +02:00
parent 0b838e3e23
commit 88964c0b6a
13 changed files with 163 additions and 41 deletions

View file

@ -432,7 +432,7 @@ impl flags::AnalysisStats {
let mut formatter = |_: &hir::Type| todo.clone();
let mut syntax_hit_found = false;
for term in found_terms {
let generated = term.gen_source_code(&scope, &mut formatter);
let generated = term.gen_source_code(&scope, &mut formatter, false, true);
syntax_hit_found |= trim(&original_text) == trim(&generated);
// Validate if type-checks

View file

@ -286,6 +286,8 @@ config_data! {
"scope": "expr"
}
}"#,
/// Whether to enable term search based snippets like `Some(foo.bar().baz())`.
completion_term_search_enable: bool = "true",
/// List of rust-analyzer diagnostics to disable.
diagnostics_disabled: FxHashSet<String> = "[]",
@ -1535,6 +1537,7 @@ impl Config {
&& completion_item_edit_resolve(&self.caps),
enable_self_on_the_fly: self.data.completion_autoself_enable,
enable_private_editable: self.data.completion_privateEditable_enable,
enable_term_search: self.data.completion_term_search_enable,
full_function_signatures: self.data.completion_fullFunctionSignatures_enable,
callable: match self.data.completion_callable_snippets {
CallableCompletionDef::FillArguments => Some(CallableSnippets::FillArguments),

View file

@ -132,6 +132,7 @@ fn integrated_completion_benchmark() {
enable_imports_on_the_fly: true,
enable_self_on_the_fly: true,
enable_private_editable: true,
enable_term_search: true,
full_function_signatures: false,
callable: Some(CallableSnippets::FillArguments),
snippet_cap: SnippetCap::new(true),
@ -175,6 +176,7 @@ fn integrated_completion_benchmark() {
enable_imports_on_the_fly: true,
enable_self_on_the_fly: true,
enable_private_editable: true,
enable_term_search: true,
full_function_signatures: false,
callable: Some(CallableSnippets::FillArguments),
snippet_cap: SnippetCap::new(true),
@ -216,6 +218,7 @@ fn integrated_completion_benchmark() {
enable_imports_on_the_fly: true,
enable_self_on_the_fly: true,
enable_private_editable: true,
enable_term_search: true,
full_function_signatures: false,
callable: Some(CallableSnippets::FillArguments),
snippet_cap: SnippetCap::new(true),