summaryrefslogtreecommitdiff
path: root/support/texlab/src/lsp_kind.rs
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-12-03 03:01:24 +0000
committerNorbert Preining <norbert@preining.info>2019-12-03 03:01:24 +0000
commitb8d4bb76703bcb15578e2b23c5d256532180b894 (patch)
treebedd1df7a00521a2bd986b3c0289d6556a59e39b /support/texlab/src/lsp_kind.rs
parent02e4625a78a5029e8b5dc2a4ec70193b232f497e (diff)
CTAN sync 201912030301
Diffstat (limited to 'support/texlab/src/lsp_kind.rs')
-rw-r--r--support/texlab/src/lsp_kind.rs93
1 files changed, 93 insertions, 0 deletions
diff --git a/support/texlab/src/lsp_kind.rs b/support/texlab/src/lsp_kind.rs
new file mode 100644
index 0000000000..0196850c61
--- /dev/null
+++ b/support/texlab/src/lsp_kind.rs
@@ -0,0 +1,93 @@
+use crate::syntax::*;
+use lsp_types::*;
+
+#[derive(Debug, PartialEq, Eq, Clone, Copy)]
+pub enum Structure {
+ Command,
+ Snippet,
+ Environment,
+ Section,
+ Float,
+ Theorem,
+ Equation,
+ Item,
+ Label,
+ Folder,
+ File,
+ PgfLibrary,
+ TikzLibrary,
+ Color,
+ ColorModel,
+ Package,
+ Class,
+ Entry(BibtexEntryTypeCategory),
+ Field,
+ Argument,
+ GlossaryEntry,
+}
+
+impl Structure {
+ pub fn completion_kind(self) -> CompletionItemKind {
+ match self {
+ Self::Command => CompletionItemKind::Function,
+ Self::Snippet => CompletionItemKind::Snippet,
+ Self::Environment => CompletionItemKind::Enum,
+ Self::Section => CompletionItemKind::Module,
+ Self::Float => CompletionItemKind::Method,
+ Self::Theorem => CompletionItemKind::Variable,
+ Self::Equation => CompletionItemKind::Constant,
+ Self::Item => CompletionItemKind::EnumMember,
+ Self::Label => CompletionItemKind::Constructor,
+ Self::Folder => CompletionItemKind::Folder,
+ Self::File => CompletionItemKind::File,
+ Self::PgfLibrary => CompletionItemKind::Property,
+ Self::TikzLibrary => CompletionItemKind::Property,
+ Self::Color => CompletionItemKind::Color,
+ Self::ColorModel => CompletionItemKind::Color,
+ Self::Package => CompletionItemKind::Class,
+ Self::Class => CompletionItemKind::Class,
+ Self::Entry(BibtexEntryTypeCategory::Misc) => CompletionItemKind::Interface,
+ Self::Entry(BibtexEntryTypeCategory::String) => CompletionItemKind::Text,
+ Self::Entry(BibtexEntryTypeCategory::Article) => CompletionItemKind::Event,
+ Self::Entry(BibtexEntryTypeCategory::Book) => CompletionItemKind::Struct,
+ Self::Entry(BibtexEntryTypeCategory::Collection) => CompletionItemKind::TypeParameter,
+ Self::Entry(BibtexEntryTypeCategory::Part) => CompletionItemKind::Operator,
+ Self::Entry(BibtexEntryTypeCategory::Thesis) => CompletionItemKind::Unit,
+ Self::Field => CompletionItemKind::Field,
+ Self::Argument => CompletionItemKind::Value,
+ Self::GlossaryEntry => CompletionItemKind::Keyword,
+ }
+ }
+
+ pub fn symbol_kind(self) -> SymbolKind {
+ match self {
+ Self::Command => SymbolKind::Function,
+ Self::Snippet => unimplemented!(),
+ Self::Environment => SymbolKind::Enum,
+ Self::Section => SymbolKind::Module,
+ Self::Float => SymbolKind::Method,
+ Self::Theorem => SymbolKind::Variable,
+ Self::Equation => SymbolKind::Constant,
+ Self::Item => SymbolKind::EnumMember,
+ Self::Label => SymbolKind::Constructor,
+ Self::Folder => SymbolKind::Namespace,
+ Self::File => SymbolKind::File,
+ Self::PgfLibrary => SymbolKind::Property,
+ Self::TikzLibrary => SymbolKind::Property,
+ Self::Color => unimplemented!(),
+ Self::ColorModel => unimplemented!(),
+ Self::Package => SymbolKind::Class,
+ Self::Class => SymbolKind::Class,
+ Self::Entry(BibtexEntryTypeCategory::Misc) => SymbolKind::Interface,
+ Self::Entry(BibtexEntryTypeCategory::String) => SymbolKind::String,
+ Self::Entry(BibtexEntryTypeCategory::Article) => SymbolKind::Event,
+ Self::Entry(BibtexEntryTypeCategory::Book) => SymbolKind::Struct,
+ Self::Entry(BibtexEntryTypeCategory::Collection) => SymbolKind::TypeParameter,
+ Self::Entry(BibtexEntryTypeCategory::Part) => SymbolKind::Operator,
+ Self::Entry(BibtexEntryTypeCategory::Thesis) => SymbolKind::Object,
+ Self::Field => SymbolKind::Field,
+ Self::Argument => SymbolKind::Number,
+ Self::GlossaryEntry => unimplemented!(),
+ }
+ }
+}