Partially unify SymbolKind and CompletionItemKind

This commit is contained in:
Lukas Wirth 2021-01-20 18:38:12 +01:00
parent 563a175fdb
commit f2cb7dbcb7
13 changed files with 128 additions and 110 deletions

View file

@ -91,24 +91,32 @@ pub(crate) fn completion_item_kind(
CompletionItemKind::Attribute => lsp_types::CompletionItemKind::EnumMember,
CompletionItemKind::Binding => lsp_types::CompletionItemKind::Variable,
CompletionItemKind::BuiltinType => lsp_types::CompletionItemKind::Struct,
CompletionItemKind::Const => lsp_types::CompletionItemKind::Constant,
CompletionItemKind::ConstParam => lsp_types::CompletionItemKind::TypeParameter,
CompletionItemKind::Enum => lsp_types::CompletionItemKind::Enum,
CompletionItemKind::EnumVariant => lsp_types::CompletionItemKind::EnumMember,
CompletionItemKind::Field => lsp_types::CompletionItemKind::Field,
CompletionItemKind::Function => lsp_types::CompletionItemKind::Function,
CompletionItemKind::Keyword => lsp_types::CompletionItemKind::Keyword,
CompletionItemKind::LifetimeParam => lsp_types::CompletionItemKind::TypeParameter,
CompletionItemKind::Macro => lsp_types::CompletionItemKind::Method,
CompletionItemKind::Method => lsp_types::CompletionItemKind::Method,
CompletionItemKind::Module => lsp_types::CompletionItemKind::Module,
CompletionItemKind::Snippet => lsp_types::CompletionItemKind::Snippet,
CompletionItemKind::Static => lsp_types::CompletionItemKind::Value,
CompletionItemKind::Struct => lsp_types::CompletionItemKind::Struct,
CompletionItemKind::Trait => lsp_types::CompletionItemKind::Interface,
CompletionItemKind::TypeAlias => lsp_types::CompletionItemKind::Struct,
CompletionItemKind::TypeParam => lsp_types::CompletionItemKind::TypeParameter,
CompletionItemKind::UnresolvedReference => lsp_types::CompletionItemKind::Reference,
CompletionItemKind::SymbolKind(symbol) => match symbol {
SymbolKind::Const => lsp_types::CompletionItemKind::Constant,
SymbolKind::ConstParam => lsp_types::CompletionItemKind::TypeParameter,
SymbolKind::Enum => lsp_types::CompletionItemKind::Enum,
SymbolKind::Field => lsp_types::CompletionItemKind::Field,
SymbolKind::Function => lsp_types::CompletionItemKind::Function,
SymbolKind::Impl => lsp_types::CompletionItemKind::Text,
SymbolKind::Label => lsp_types::CompletionItemKind::Variable,
SymbolKind::LifetimeParam => lsp_types::CompletionItemKind::TypeParameter,
SymbolKind::Local => lsp_types::CompletionItemKind::Variable,
SymbolKind::Macro => lsp_types::CompletionItemKind::Method,
SymbolKind::Module => lsp_types::CompletionItemKind::Module,
SymbolKind::SelfParam => lsp_types::CompletionItemKind::Value,
SymbolKind::Static => lsp_types::CompletionItemKind::Value,
SymbolKind::Struct => lsp_types::CompletionItemKind::Struct,
SymbolKind::Trait => lsp_types::CompletionItemKind::Interface,
SymbolKind::TypeAlias => lsp_types::CompletionItemKind::Struct,
SymbolKind::TypeParam => lsp_types::CompletionItemKind::TypeParameter,
SymbolKind::Union => lsp_types::CompletionItemKind::Struct,
SymbolKind::ValueParam => lsp_types::CompletionItemKind::Value,
SymbolKind::Variant => lsp_types::CompletionItemKind::EnumMember,
},
}
}