fix: add fallback for completion label details

This commit is contained in:
Andrew Hlynskyi 2023-11-24 15:24:57 +02:00
parent 34cffbf1d7
commit 94cea4663a
2 changed files with 3 additions and 1 deletions

View File

@ -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>,

View File

@ -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);