mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Add semantic highlight to QUESTION token
Made it an operator with controlFlow modifier.
This commit is contained in:
parent
30658b25d2
commit
18aa4bcb03
3 changed files with 4 additions and 0 deletions
|
@ -391,6 +391,7 @@ fn highlight_element(
|
||||||
INT_NUMBER | FLOAT_NUMBER => HighlightTag::NumericLiteral.into(),
|
INT_NUMBER | FLOAT_NUMBER => HighlightTag::NumericLiteral.into(),
|
||||||
BYTE => HighlightTag::ByteLiteral.into(),
|
BYTE => HighlightTag::ByteLiteral.into(),
|
||||||
CHAR => HighlightTag::CharLiteral.into(),
|
CHAR => HighlightTag::CharLiteral.into(),
|
||||||
|
QUESTION => Highlight::new(HighlightTag::Operator) | HighlightModifier::ControlFlow,
|
||||||
LIFETIME => {
|
LIFETIME => {
|
||||||
let h = Highlight::new(HighlightTag::Lifetime);
|
let h = Highlight::new(HighlightTag::Lifetime);
|
||||||
match element.parent().map(|it| it.kind()) {
|
match element.parent().map(|it| it.kind()) {
|
||||||
|
|
|
@ -42,6 +42,7 @@ pub enum HighlightTag {
|
||||||
Local,
|
Local,
|
||||||
UnresolvedReference,
|
UnresolvedReference,
|
||||||
FormatSpecifier,
|
FormatSpecifier,
|
||||||
|
Operator,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
|
@ -89,6 +90,7 @@ impl HighlightTag {
|
||||||
HighlightTag::Local => "variable",
|
HighlightTag::Local => "variable",
|
||||||
HighlightTag::UnresolvedReference => "unresolved_reference",
|
HighlightTag::UnresolvedReference => "unresolved_reference",
|
||||||
HighlightTag::FormatSpecifier => "format_specifier",
|
HighlightTag::FormatSpecifier => "format_specifier",
|
||||||
|
HighlightTag::Operator => "operator",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,6 +317,7 @@ fn semantic_token_type_and_modifiers(
|
||||||
HighlightTag::Keyword => lsp_types::SemanticTokenType::KEYWORD,
|
HighlightTag::Keyword => lsp_types::SemanticTokenType::KEYWORD,
|
||||||
HighlightTag::UnresolvedReference => semantic_tokens::UNRESOLVED_REFERENCE,
|
HighlightTag::UnresolvedReference => semantic_tokens::UNRESOLVED_REFERENCE,
|
||||||
HighlightTag::FormatSpecifier => semantic_tokens::FORMAT_SPECIFIER,
|
HighlightTag::FormatSpecifier => semantic_tokens::FORMAT_SPECIFIER,
|
||||||
|
HighlightTag::Operator => lsp_types::SemanticTokenType::OPERATOR,
|
||||||
};
|
};
|
||||||
|
|
||||||
for modifier in highlight.modifiers.iter() {
|
for modifier in highlight.modifiers.iter() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue