mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Fix unary minus highlighting
This commit is contained in:
parent
91c1af3612
commit
c9af469b85
3 changed files with 14 additions and 1 deletions
|
@ -579,7 +579,14 @@ fn highlight_element(
|
|||
}
|
||||
}
|
||||
T![-] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => {
|
||||
HighlightTag::NumericLiteral.into()
|
||||
let prefix_expr = element.parent().and_then(ast::PrefixExpr::cast)?;
|
||||
|
||||
let expr = prefix_expr.expr()?;
|
||||
match expr {
|
||||
ast::Expr::Literal(_) => HighlightTag::NumericLiteral,
|
||||
_ => HighlightTag::Operator,
|
||||
}
|
||||
.into()
|
||||
}
|
||||
_ if element.parent().and_then(ast::PrefixExpr::cast).is_some() => {
|
||||
HighlightTag::Operator.into()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue