From 8c171f970a86d6e34414a24667d3022f6ee12374 Mon Sep 17 00:00:00 2001 From: Marko Klobucar Ledinscak Date: Tue, 8 Nov 2022 18:42:56 +0100 Subject: [PATCH 1/3] `error!` on unknown `CompletionItemKind` Instead of panicking on an unknown CompletionItemKind, `error!` it instead and return `""`. --- helix-term/src/ui/completion.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index 5ec8cf892bc6..9d30573aebb6 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -66,7 +66,10 @@ impl menu::Item for CompletionItem { Some(lsp::CompletionItemKind::EVENT) => "event", Some(lsp::CompletionItemKind::OPERATOR) => "operator", Some(lsp::CompletionItemKind::TYPE_PARAMETER) => "type_param", - Some(kind) => unimplemented!("{:?}", kind), + Some(kind) => { + log::error!("Received unknown CompletionItemKind({:?})", kind); + "" + }, None => "", }), // self.detail.as_deref().unwrap_or("") From 24e6cc71fa17e651139eedb431bc10d2f13cb6ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Klobu=C4=8Dar=20Ledin=C5=A1=C4=87ak?= Date: Tue, 8 Nov 2022 18:58:37 +0100 Subject: [PATCH 2/3] Update helix-term/src/ui/completion.rs No need to explicitly log CompletionItemKind Co-authored-by: Michael Davis --- helix-term/src/ui/completion.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index 9d30573aebb6..f1e0cddddc49 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -67,7 +67,7 @@ impl menu::Item for CompletionItem { Some(lsp::CompletionItemKind::OPERATOR) => "operator", Some(lsp::CompletionItemKind::TYPE_PARAMETER) => "type_param", Some(kind) => { - log::error!("Received unknown CompletionItemKind({:?})", kind); + log::error!("Received unknown completion item kind: {:?}", kind); "" }, None => "", From 64767e57cb505713d48ac5ef7d91fd2a88423b37 Mon Sep 17 00:00:00 2001 From: Marko Klobucar Ledinscak Date: Tue, 8 Nov 2022 19:11:59 +0100 Subject: [PATCH 3/3] Appease linter by removing final , --- helix-term/src/ui/completion.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index f1e0cddddc49..545b19d8968f 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -69,7 +69,7 @@ impl menu::Item for CompletionItem { Some(kind) => { log::error!("Received unknown completion item kind: {:?}", kind); "" - }, + } None => "", }), // self.detail.as_deref().unwrap_or("")