diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 819d6784a5..a8e93c39f8 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -55,7 +55,6 @@ pub(super) fn element( name_ref, ) } - // Simple token-based highlighting COMMENT => { let comment = element.into_token().and_then(ast::Comment::cast)?; @@ -132,16 +131,18 @@ pub(super) fn element( .into() } _ if parent_matches::(&element) => HlOperator::Other.into(), - T![+] | T![-] | T![*] | T![/] | T![+=] | T![-=] | T![*=] | T![/=] - if parent_matches::(&element) => - { + T![+] | T![-] | T![*] | T![/] if parent_matches::(&element) => { HlOperator::Arithmetic.into() } - T![|] | T![&] | T![!] | T![^] | T![|=] | T![&=] | T![^=] - if parent_matches::(&element) => - { + T![+=] | T![-=] | T![*=] | T![/=] if parent_matches::(&element) => { + Highlight::from(HlOperator::Arithmetic) | HlMod::Mutable + } + T![|] | T![&] | T![!] | T![^] if parent_matches::(&element) => { HlOperator::Bitwise.into() } + T![|=] | T![&=] | T![^=] if parent_matches::(&element) => { + Highlight::from(HlOperator::Bitwise) | HlMod::Mutable + } T![&&] | T![||] if parent_matches::(&element) => { HlOperator::Logical.into() } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index 96969a7bb3..04148767d0 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html @@ -195,6 +195,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd noop!(noop!(1)); let mut x = 42; + x += 1; let y = &mut x; let z = &y; diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index 81a98a606e..740127202f 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs @@ -168,6 +168,7 @@ fn main() { noop!(noop!(1)); let mut x = 42; + x += 1; let y = &mut x; let z = &y;