Skip to content

Commit ee7c8b9

Browse files
committed
Auto merge of #18245 - boattime:master, r=davidbarsky
fix: include description in label details when detail field is marked for … Fixes rust-lang/rust-analyzer#18231. When omitting the autocomplete detail field, the autocomplete label details can still be returned. Currently the label details are missing the description field if the detail field is included in resolveSupport since it is being overwritten as None and opted to be sent with `completionItem/resolve`. Example completion capabilities. ``` completion = { completionItem = { commitCharactersSupport = true, deprecatedSupport = true, documentationFormat = { "markdown", "plaintext" }, insertReplaceSupport = true, insertTextModeSupport = { valueSet = { 1, 2 } }, labelDetailsSupport = true, preselectSupport = true, resolveSupport = { properties = { "documentation", "detail", "additionalTextEdits", "sortText", "filterText", "insertText", "textEdit", "insertTextFormat", "insertTextMode" } }, snippetSupport = true, tagSupport = { valueSet = { 1 } } } ```
2 parents 3e42fc5 + 429d46d commit ee7c8b9

File tree

1 file changed

+2
-2
lines changed
  • src/tools/rust-analyzer/crates/rust-analyzer/src/lsp

1 file changed

+2
-2
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ fn completion_item(
339339
something_to_resolve |= item.detail.is_some();
340340
None
341341
} else {
342-
item.detail
342+
item.detail.clone()
343343
};
344344

345345
let documentation = if fields_to_resolve.resolve_documentation {
@@ -370,7 +370,7 @@ fn completion_item(
370370
} else {
371371
lsp_item.label_details = Some(lsp_types::CompletionItemLabelDetails {
372372
detail: item.label_detail.as_ref().map(ToString::to_string),
373-
description: lsp_item.detail.clone(),
373+
description: item.detail,
374374
});
375375
}
376376
} else if let Some(label_detail) = item.label_detail {

0 commit comments

Comments
 (0)