aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/syntax_highlighting/tags.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-10 12:45:07 +0000
committerGitHub <[email protected]>2021-01-10 12:45:07 +0000
commit77362c71735a8b5ab4b5cd9f396fa657fbffe2cb (patch)
tree8c47a7929d15e6e4b36a854a662c3ea5ee7d972c /crates/ide/src/syntax_highlighting/tags.rs
parentdcbb77cb6c75db9b300abe0fe6ed4668e2ef1193 (diff)
parent78fe6133c4908aefcf5c690e665abba9ef2389eb (diff)
Merge #6238
6238: Split punctuation semantic highlighting up into more tags r=matklad a=Veykril Open question would be the name of the delimiter modifiers. I chose them this was as I see them this way but from what I remember people tend to mix the names however they like. So maybe using `delimSquare`, `delimCurly`, `delimRound` would be better. That would also go well with `angle` becoming `delimAngle`? Closes #6152 Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide/src/syntax_highlighting/tags.rs')
-rw-r--r--crates/ide/src/syntax_highlighting/tags.rs36
1 files changed, 34 insertions, 2 deletions
diff --git a/crates/ide/src/syntax_highlighting/tags.rs b/crates/ide/src/syntax_highlighting/tags.rs
index 2f39bcc8e..a4396e790 100644
--- a/crates/ide/src/syntax_highlighting/tags.rs
+++ b/crates/ide/src/syntax_highlighting/tags.rs
@@ -29,7 +29,7 @@ pub enum HlTag {
29 EscapeSequence, 29 EscapeSequence,
30 FormatSpecifier, 30 FormatSpecifier,
31 Keyword, 31 Keyword,
32 Punctuation, 32 Punctuation(HlPunct),
33 Operator, 33 Operator,
34 UnresolvedReference, 34 UnresolvedReference,
35 35
@@ -61,6 +61,28 @@ pub enum HlMod {
61 Unsafe, 61 Unsafe,
62} 62}
63 63
64#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
65pub enum HlPunct {
66 /// []
67 Bracket,
68 /// {}
69 Brace,
70 /// ()
71 Parenthesis,
72 /// <>
73 Angle,
74 /// ,
75 Comma,
76 /// .
77 Dot,
78 /// :
79 Colon,
80 /// ;
81 Semi,
82 ///
83 Other,
84}
85
64impl HlTag { 86impl HlTag {
65 fn as_str(self) -> &'static str { 87 fn as_str(self) -> &'static str {
66 match self { 88 match self {
@@ -95,7 +117,17 @@ impl HlTag {
95 HlTag::EscapeSequence => "escape_sequence", 117 HlTag::EscapeSequence => "escape_sequence",
96 HlTag::FormatSpecifier => "format_specifier", 118 HlTag::FormatSpecifier => "format_specifier",
97 HlTag::Keyword => "keyword", 119 HlTag::Keyword => "keyword",
98 HlTag::Punctuation => "punctuation", 120 HlTag::Punctuation(punct) => match punct {
121 HlPunct::Bracket => "bracket",
122 HlPunct::Brace => "brace",
123 HlPunct::Parenthesis => "parentheses",
124 HlPunct::Angle => "angle",
125 HlPunct::Comma => "comma",
126 HlPunct::Dot => "dot",
127 HlPunct::Colon => "colon",
128 HlPunct::Semi => "semicolon",
129 HlPunct::Other => "punctuation",
130 },
99 HlTag::NumericLiteral => "numeric_literal", 131 HlTag::NumericLiteral => "numeric_literal",
100 HlTag::Operator => "operator", 132 HlTag::Operator => "operator",
101 HlTag::StringLiteral => "string_literal", 133 HlTag::StringLiteral => "string_literal",