aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/syntax_highlighting.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/syntax_highlighting.rs')
-rw-r--r--crates/ide/src/syntax_highlighting.rs9
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()