summaryrefslogtreecommitdiff
path: root/support/texlab/crates/texlab/src/util/lsp_enums.rs
blob: 352b392868465e3d3ed1babd9ebc08c4d02c7222 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use base_db::data::BibtexEntryTypeCategory;
use lsp_types::CompletionItemKind;

#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Structure {
    Command,
    Snippet,
    Environment,
    Section,
    Float,
    Theorem,
    Equation,
    Item,
    Label,
    Folder,
    File,
    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::ENUM_MEMBER,
            Self::Label => CompletionItemKind::CONSTRUCTOR,
            Self::Folder => CompletionItemKind::FOLDER,
            Self::File => CompletionItemKind::FILE,
            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::TYPE_PARAMETER,
            Self::Entry(BibtexEntryTypeCategory::Part) => CompletionItemKind::OPERATOR,
            Self::Entry(BibtexEntryTypeCategory::Thesis) => CompletionItemKind::UNIT,
            Self::Field => CompletionItemKind::FIELD,
            Self::Argument => CompletionItemKind::VALUE,
            Self::GlossaryEntry => CompletionItemKind::KEYWORD,
        }
    }
}