diff options
author | Lukas Wirth <[email protected]> | 2020-10-25 22:05:30 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2020-10-25 22:05:30 +0000 |
commit | c9af469b85854ec96318b96d7d1fde0935ee4e34 (patch) | |
tree | ffd9c15ba01fc180781b70cb31a0f64a398193b9 /crates/ide/src/syntax_highlighting.rs | |
parent | 91c1af36120ed9b5ad1da4972ab18d0d042e991f (diff) |
Fix unary minus highlighting
Diffstat (limited to 'crates/ide/src/syntax_highlighting.rs')
-rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 750848467..9f864179e 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -579,7 +579,14 @@ fn highlight_element( | |||
579 | } | 579 | } |
580 | } | 580 | } |
581 | T![-] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => { | 581 | T![-] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => { |
582 | HighlightTag::NumericLiteral.into() | 582 | let prefix_expr = element.parent().and_then(ast::PrefixExpr::cast)?; |
583 | |||
584 | let expr = prefix_expr.expr()?; | ||
585 | match expr { | ||
586 | ast::Expr::Literal(_) => HighlightTag::NumericLiteral, | ||
587 | _ => HighlightTag::Operator, | ||
588 | } | ||
589 | .into() | ||
583 | } | 590 | } |
584 | _ if element.parent().and_then(ast::PrefixExpr::cast).is_some() => { | 591 | _ if element.parent().and_then(ast::PrefixExpr::cast).is_some() => { |
585 | HighlightTag::Operator.into() | 592 | HighlightTag::Operator.into() |