From 94cea4663a3a826beccfeb291187df4849fe990e Mon Sep 17 00:00:00 2001 From: Andrew Hlynskyi Date: Fri, 24 Nov 2023 15:24:57 +0200 Subject: [PATCH] fix: add fallback for completion label details --- crates/ide-completion/src/item.rs | 2 +- crates/rust-analyzer/src/lsp/to_proto.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ide-completion/src/item.rs b/crates/ide-completion/src/item.rs index 5397a9fc90b9..99b895eed4d2 100644 --- a/crates/ide-completion/src/item.rs +++ b/crates/ide-completion/src/item.rs @@ -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, diff --git a/crates/rust-analyzer/src/lsp/to_proto.rs b/crates/rust-analyzer/src/lsp/to_proto.rs index b4ba5bf4f91a..fb366fd5cc41 100644 --- a/crates/rust-analyzer/src/lsp/to_proto.rs +++ b/crates/rust-analyzer/src/lsp/to_proto.rs @@ -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);