Skip to content

Commit

Permalink
Auto merge of #18245 - boattime:master, r=davidbarsky
Browse files Browse the repository at this point in the history
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 }
        }
}
```
  • Loading branch information
bors committed Oct 9, 2024
2 parents 3e42fc5 + 429d46d commit ee7c8b9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ fn completion_item(
something_to_resolve |= item.detail.is_some();
None
} else {
item.detail
item.detail.clone()
};

let documentation = if fields_to_resolve.resolve_documentation {
Expand Down Expand Up @@ -370,7 +370,7 @@ fn completion_item(
} else {
lsp_item.label_details = Some(lsp_types::CompletionItemLabelDetails {
detail: item.label_detail.as_ref().map(ToString::to_string),
description: lsp_item.detail.clone(),
description: item.detail,
});
}
} else if let Some(label_detail) = item.label_detail {
Expand Down

0 comments on commit ee7c8b9

Please sign in to comment.