diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs
index 719daa0f..f79c2235 100644
--- a/helix-term/src/ui/completion.rs
+++ b/helix-term/src/ui/completion.rs
@@ -12,11 +12,63 @@ use helix_core::{Position, Transaction};
use helix_view::Editor;
use crate::commands;
-use crate::ui::{Markdown, Menu, Popup, PromptEvent};
+use crate::ui::{menu, Markdown, Menu, Popup, PromptEvent};
use helix_lsp::lsp;
use lsp::CompletionItem;
+impl menu::Item for CompletionItem {
+ fn filter_text(&self) -> &str {
+ self.filter_text
+ .as_ref()
+ .unwrap_or_else(|| &self.label)
+ .as_str()
+ }
+
+ fn label(&self) -> &str {
+ self.label.as_str()
+ }
+
+ fn row(&self) -> menu::Row {
+ menu::Row::new(vec![
+ menu::Cell::from(self.label.as_str()),
+ menu::Cell::from(match self.kind {
+ Some(lsp::CompletionItemKind::Text) => "text",
+ Some(lsp::CompletionItemKind::Method) => "method",
+ Some(lsp::CompletionItemKind::Function) => "function",
+ Some(lsp::CompletionItemKind::Constructor) => "constructor",
+ Some(lsp::CompletionItemKind::Field) => "field",
+ Some(lsp::CompletionItemKind::Variable) => "variable",
+ Some(lsp::CompletionItemKind::Class) => "class",
+ Some(lsp::CompletionItemKind::Interface) => "interface",
+ Some(lsp::CompletionItemKind::Module) => "module",
+ Some(lsp::CompletionItemKind::Property) => "property",
+ Some(lsp::CompletionItemKind::Unit) => "unit",
+ Some(lsp::CompletionItemKind::Value) => "value",
+ Some(lsp::CompletionItemKind::Enum) => "enum",
+ Some(lsp::CompletionItemKind::Keyword) => "keyword",
+ Some(lsp::CompletionItemKind::Snippet) => "snippet",
+ Some(lsp::CompletionItemKind::Color) => "color",
+ Some(lsp::CompletionItemKind::File) => "file",
+ Some(lsp::CompletionItemKind::Reference) => "reference",
+ Some(lsp::CompletionItemKind::Folder) => "folder",
+ Some(lsp::CompletionItemKind::EnumMember) => "enum_member",
+ Some(lsp::CompletionItemKind::Constant) => "constant",
+ Some(lsp::CompletionItemKind::Struct) => "struct",
+ Some(lsp::CompletionItemKind::Event) => "event",
+ Some(lsp::CompletionItemKind::Operator) => "operator",
+ Some(lsp::CompletionItemKind::TypeParameter) => "type_param",
+ None => "",
+ }),
+ // self.detail.as_deref().unwrap_or("")
+ // self.label_details
+ // .as_ref()
+ // .or(self.detail())
+ // .as_str(),
+ ])
+ }
+}
+
/// Wraps a Menu.
pub struct Completion {
popup: Popup