Skip to content

Commit 68cb0a9

Browse files
committed
Added the "negation" semantic token
1 parent 5057787 commit 68cb0a9

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ fn punctuation(
137137
}
138138
(T![!], MACRO_RULES) => HlPunct::MacroBang.into(),
139139
(T![!], NEVER_TYPE) => HlTag::BuiltinType.into(),
140-
(T![!], PREFIX_EXPR) => HlOperator::Logical.into(),
140+
(T![!], PREFIX_EXPR) => HlOperator::Negation.into(),
141141
(T![*], PTR_TYPE) => HlTag::Keyword.into(),
142142
(T![*], PREFIX_EXPR) => {
143143
let h = HlTag::Operator(HlOperator::Other).into();

src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/tags.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ pub enum HlOperator {
124124
Bitwise,
125125
/// +, -, *, /, +=, -=, *=, /=
126126
Arithmetic,
127-
/// &&, ||, !
127+
/// &&, ||
128128
Logical,
129+
/// !
130+
Negation,
129131
/// >, <, ==, >=, <=, !=
130132
Comparison,
131133
/// Other operators
@@ -194,6 +196,7 @@ impl HlTag {
194196
HlOperator::Arithmetic => "arithmetic",
195197
HlOperator::Logical => "logical",
196198
HlOperator::Comparison => "comparison",
199+
HlOperator::Negation => "negation",
197200
HlOperator::Other => "operator",
198201
},
199202
HlTag::StringLiteral => "string_literal",

src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/semantic_tokens.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ define_semantic_token_types![
9191
(LIFETIME, "lifetime"),
9292
(LOGICAL, "logical") => OPERATOR,
9393
(MACRO_BANG, "macroBang") => MACRO,
94+
(NEGATION, "negation") => OPERATOR,
9495
(PARENTHESIS, "parenthesis"),
9596
(PROC_MACRO, "procMacro") => MACRO,
9697
(PUNCTUATION, "punctuation"),

src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/to_proto.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ fn semantic_token_type_and_modifiers(
840840
HlOperator::Bitwise => types::BITWISE,
841841
HlOperator::Arithmetic => types::ARITHMETIC,
842842
HlOperator::Logical => types::LOGICAL,
843+
HlOperator::Negation => types::NEGATION,
843844
HlOperator::Comparison => types::COMPARISON,
844845
HlOperator::Other => types::OPERATOR,
845846
},

0 commit comments

Comments
 (0)