mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
Auto merge of #15962 - ahlinc:label-datail2, r=lnicola
fix: add fallback for completion label details This PR adds a fallback to a previous implementation in a case when the label detail field isn't supported by LSP client and the support isn't reported by the LSP initialize request. In this case additional info about trait and aliases would be merged into the label field as it was before the #15956 PR.
This commit is contained in:
commit
35da60a2bc
@ -26,7 +26,7 @@ use crate::{
|
||||
pub struct CompletionItem {
|
||||
/// Label in the completion pop up which identifies completion.
|
||||
pub label: SmolStr,
|
||||
/// Addition label details in the completion pop up that are
|
||||
/// Additional label details in the completion pop up that are
|
||||
/// displayed and aligned on the right side after the label.
|
||||
pub label_detail: Option<SmolStr>,
|
||||
|
||||
|
@ -304,6 +304,8 @@ fn completion_item(
|
||||
detail: item.label_detail.as_ref().map(ToString::to_string),
|
||||
description: lsp_item.detail.clone(),
|
||||
});
|
||||
} else if let Some(label_detail) = item.label_detail {
|
||||
lsp_item.label.push_str(label_detail.as_str());
|
||||
}
|
||||
|
||||
set_score(&mut lsp_item, max_relevance, item.relevance);
|
||||
|
Loading…
Reference in New Issue
Block a user