lsp: fix completion_item something_to_resolve not being a latch to true

This commit is contained in:
Jake 2024-10-05 15:51:23 -07:00
parent 5982d9c420
commit bab2a6ec94
No known key found for this signature in database

View file

@ -280,14 +280,14 @@ fn completion_item(
let mut something_to_resolve = false; let mut something_to_resolve = false;
let filter_text = if fields_to_resolve.resolve_filter_text { let filter_text = if fields_to_resolve.resolve_filter_text {
something_to_resolve = !item.lookup().is_empty(); something_to_resolve |= !item.lookup().is_empty();
None None
} else { } else {
Some(item.lookup().to_owned()) Some(item.lookup().to_owned())
}; };
let text_edit = if fields_to_resolve.resolve_text_edit { let text_edit = if fields_to_resolve.resolve_text_edit {
something_to_resolve = true; something_to_resolve |= true;
None None
} else { } else {
// LSP does not allow arbitrary edits in completion, so we have to do a // LSP does not allow arbitrary edits in completion, so we have to do a
@ -319,14 +319,14 @@ fn completion_item(
let insert_text_format = item.is_snippet.then_some(lsp_types::InsertTextFormat::SNIPPET); let insert_text_format = item.is_snippet.then_some(lsp_types::InsertTextFormat::SNIPPET);
let tags = if fields_to_resolve.resolve_tags { let tags = if fields_to_resolve.resolve_tags {
something_to_resolve = item.deprecated; something_to_resolve |= item.deprecated;
None None
} else { } else {
item.deprecated.then(|| vec![lsp_types::CompletionItemTag::DEPRECATED]) item.deprecated.then(|| vec![lsp_types::CompletionItemTag::DEPRECATED])
}; };
let command = if item.trigger_call_info && config.client_commands().trigger_parameter_hints { let command = if item.trigger_call_info && config.client_commands().trigger_parameter_hints {
if fields_to_resolve.resolve_command { if fields_to_resolve.resolve_command {
something_to_resolve = true; something_to_resolve |= true;
None None
} else { } else {
Some(command::trigger_parameter_hints()) Some(command::trigger_parameter_hints())
@ -336,14 +336,14 @@ fn completion_item(
}; };
let detail = if fields_to_resolve.resolve_detail { let detail = if fields_to_resolve.resolve_detail {
something_to_resolve = item.detail.is_some(); something_to_resolve |= item.detail.is_some();
None None
} else { } else {
item.detail item.detail
}; };
let documentation = if fields_to_resolve.resolve_documentation { let documentation = if fields_to_resolve.resolve_documentation {
something_to_resolve = item.documentation.is_some(); something_to_resolve |= item.documentation.is_some();
None None
} else { } else {
item.documentation.map(documentation) item.documentation.map(documentation)
@ -366,7 +366,7 @@ fn completion_item(
if config.completion_label_details_support() { if config.completion_label_details_support() {
if fields_to_resolve.resolve_label_details { if fields_to_resolve.resolve_label_details {
something_to_resolve = true; something_to_resolve |= true;
} else { } else {
lsp_item.label_details = Some(lsp_types::CompletionItemLabelDetails { lsp_item.label_details = Some(lsp_types::CompletionItemLabelDetails {
detail: item.label_detail.as_ref().map(ToString::to_string), detail: item.label_detail.as_ref().map(ToString::to_string),