diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-10-26 13:07:25 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-26 13:07:25 +0000 |
commit | 35ed3d2c005fdb0ec9ab78a52b31758bd7de298e (patch) | |
tree | 45ad752dbb6aa39c3309c6c47f8ac041c5caa380 /crates/ide/src/syntax_highlighting.rs | |
parent | 6d80dfaabb00008062a16f7b9bf327c9fd4b72d1 (diff) | |
parent | c9af469b85854ec96318b96d7d1fde0935ee4e34 (diff) |
Merge #6360
6360: Fix unary minus highlighting r=matklad a=Veykril
Fixes #6358
Co-authored-by: Lukas Wirth <[email protected]>
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() |