diff options
author | Mikhail Rakhmanov <[email protected]> | 2020-06-03 19:10:54 +0100 |
---|---|---|
committer | Mikhail Rakhmanov <[email protected]> | 2020-06-03 19:10:54 +0100 |
commit | eefa10bc6bff3624ddd0bbb6bc89d8beb4bed186 (patch) | |
tree | 15c38c2993c52f4065d338090ca9185cc1fcd3da /crates/ra_ide/src/syntax_highlighting/tags.rs | |
parent | a9d567584857b1be4ca8eaa5ef2c7d85f7b2845e (diff) | |
parent | 794f6da821c5d6e2490b996baffe162e4753262d (diff) |
Merge branch 'master' into assists_extract_enum
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting/tags.rs')
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/tags.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting/tags.rs b/crates/ra_ide/src/syntax_highlighting/tags.rs index be1a0f12b..94f466966 100644 --- a/crates/ra_ide/src/syntax_highlighting/tags.rs +++ b/crates/ra_ide/src/syntax_highlighting/tags.rs | |||
@@ -15,6 +15,7 @@ pub struct HighlightModifiers(u32); | |||
15 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] | 15 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] |
16 | pub enum HighlightTag { | 16 | pub enum HighlightTag { |
17 | Attribute, | 17 | Attribute, |
18 | BoolLiteral, | ||
18 | BuiltinType, | 19 | BuiltinType, |
19 | ByteLiteral, | 20 | ByteLiteral, |
20 | CharLiteral, | 21 | CharLiteral, |
@@ -23,12 +24,15 @@ pub enum HighlightTag { | |||
23 | Enum, | 24 | Enum, |
24 | EnumVariant, | 25 | EnumVariant, |
25 | Field, | 26 | Field, |
27 | FormatSpecifier, | ||
26 | Function, | 28 | Function, |
27 | Keyword, | 29 | Keyword, |
28 | Lifetime, | 30 | Lifetime, |
29 | Macro, | 31 | Macro, |
30 | Module, | 32 | Module, |
31 | NumericLiteral, | 33 | NumericLiteral, |
34 | Operator, | ||
35 | SelfKeyword, | ||
32 | SelfType, | 36 | SelfType, |
33 | Static, | 37 | Static, |
34 | StringLiteral, | 38 | StringLiteral, |
@@ -39,14 +43,15 @@ pub enum HighlightTag { | |||
39 | Union, | 43 | Union, |
40 | Local, | 44 | Local, |
41 | UnresolvedReference, | 45 | UnresolvedReference, |
42 | FormatSpecifier, | ||
43 | } | 46 | } |
44 | 47 | ||
45 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] | 48 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] |
46 | #[repr(u8)] | 49 | #[repr(u8)] |
47 | pub enum HighlightModifier { | 50 | pub enum HighlightModifier { |
51 | /// Used to differentiate individual elements within attributes. | ||
52 | Attribute = 0, | ||
48 | /// Used with keywords like `if` and `break`. | 53 | /// Used with keywords like `if` and `break`. |
49 | ControlFlow = 0, | 54 | ControlFlow, |
50 | /// `foo` in `fn foo(x: i32)` is a definition, `foo` in `foo(90 + 2)` is | 55 | /// `foo` in `fn foo(x: i32)` is a definition, `foo` in `foo(90 + 2)` is |
51 | /// not. | 56 | /// not. |
52 | Definition, | 57 | Definition, |
@@ -58,6 +63,7 @@ impl HighlightTag { | |||
58 | fn as_str(self) -> &'static str { | 63 | fn as_str(self) -> &'static str { |
59 | match self { | 64 | match self { |
60 | HighlightTag::Attribute => "attribute", | 65 | HighlightTag::Attribute => "attribute", |
66 | HighlightTag::BoolLiteral => "bool_literal", | ||
61 | HighlightTag::BuiltinType => "builtin_type", | 67 | HighlightTag::BuiltinType => "builtin_type", |
62 | HighlightTag::ByteLiteral => "byte_literal", | 68 | HighlightTag::ByteLiteral => "byte_literal", |
63 | HighlightTag::CharLiteral => "char_literal", | 69 | HighlightTag::CharLiteral => "char_literal", |
@@ -66,12 +72,15 @@ impl HighlightTag { | |||
66 | HighlightTag::Enum => "enum", | 72 | HighlightTag::Enum => "enum", |
67 | HighlightTag::EnumVariant => "enum_variant", | 73 | HighlightTag::EnumVariant => "enum_variant", |
68 | HighlightTag::Field => "field", | 74 | HighlightTag::Field => "field", |
75 | HighlightTag::FormatSpecifier => "format_specifier", | ||
69 | HighlightTag::Function => "function", | 76 | HighlightTag::Function => "function", |
70 | HighlightTag::Keyword => "keyword", | 77 | HighlightTag::Keyword => "keyword", |
71 | HighlightTag::Lifetime => "lifetime", | 78 | HighlightTag::Lifetime => "lifetime", |
72 | HighlightTag::Macro => "macro", | 79 | HighlightTag::Macro => "macro", |
73 | HighlightTag::Module => "module", | 80 | HighlightTag::Module => "module", |
74 | HighlightTag::NumericLiteral => "numeric_literal", | 81 | HighlightTag::NumericLiteral => "numeric_literal", |
82 | HighlightTag::Operator => "operator", | ||
83 | HighlightTag::SelfKeyword => "self_keyword", | ||
75 | HighlightTag::SelfType => "self_type", | 84 | HighlightTag::SelfType => "self_type", |
76 | HighlightTag::Static => "static", | 85 | HighlightTag::Static => "static", |
77 | HighlightTag::StringLiteral => "string_literal", | 86 | HighlightTag::StringLiteral => "string_literal", |
@@ -82,7 +91,6 @@ impl HighlightTag { | |||
82 | HighlightTag::Union => "union", | 91 | HighlightTag::Union => "union", |
83 | HighlightTag::Local => "variable", | 92 | HighlightTag::Local => "variable", |
84 | HighlightTag::UnresolvedReference => "unresolved_reference", | 93 | HighlightTag::UnresolvedReference => "unresolved_reference", |
85 | HighlightTag::FormatSpecifier => "format_specifier", | ||
86 | } | 94 | } |
87 | } | 95 | } |
88 | } | 96 | } |
@@ -95,6 +103,7 @@ impl fmt::Display for HighlightTag { | |||
95 | 103 | ||
96 | impl HighlightModifier { | 104 | impl HighlightModifier { |
97 | const ALL: &'static [HighlightModifier] = &[ | 105 | const ALL: &'static [HighlightModifier] = &[ |
106 | HighlightModifier::Attribute, | ||
98 | HighlightModifier::ControlFlow, | 107 | HighlightModifier::ControlFlow, |
99 | HighlightModifier::Definition, | 108 | HighlightModifier::Definition, |
100 | HighlightModifier::Mutable, | 109 | HighlightModifier::Mutable, |
@@ -103,6 +112,7 @@ impl HighlightModifier { | |||
103 | 112 | ||
104 | fn as_str(self) -> &'static str { | 113 | fn as_str(self) -> &'static str { |
105 | match self { | 114 | match self { |
115 | HighlightModifier::Attribute => "attribute", | ||
106 | HighlightModifier::ControlFlow => "control", | 116 | HighlightModifier::ControlFlow => "control", |
107 | HighlightModifier::Definition => "declaration", | 117 | HighlightModifier::Definition => "declaration", |
108 | HighlightModifier::Mutable => "mutable", | 118 | HighlightModifier::Mutable => "mutable", |