From 5ca3855c06b6e28aaa99f5fdda41b6b80ed871b7 Mon Sep 17 00:00:00 2001 From: GrayJack Date: Mon, 20 Jul 2020 23:37:31 -0300 Subject: On second thought, we want to preserve the textMate here where all punctuation that are from a Attr be highlited as Attribute --- crates/ra_ide/src/syntax_highlighting.rs | 4 +++- crates/ra_ide/test_data/highlight_doctest.html | 2 +- crates/ra_ide/test_data/highlighting.html | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 036180c60..d456d5d36 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -540,7 +540,6 @@ fn highlight_element( } } p if p.is_punct() => match p { - T![#] => HighlightTag::Attribute.into(), T![::] | T![->] | T![=>] | T![&] | T![..] | T![=] | T![@] => { HighlightTag::Operator.into() } @@ -581,6 +580,9 @@ fn highlight_element( _ if element.parent().and_then(ast::DotDotPat::cast).is_some() => { HighlightTag::Operator.into() } + _ if element.parent().and_then(ast::Attr::cast).is_some() => { + HighlightTag::Attribute.into() + } _ => HighlightTag::Punctuation.into(), }, diff --git a/crates/ra_ide/test_data/highlight_doctest.html b/crates/ra_ide/test_data/highlight_doctest.html index 78c2a30c3..6322d404f 100644 --- a/crates/ra_ide/test_data/highlight_doctest.html +++ b/crates/ra_ide/test_data/highlight_doctest.html @@ -50,7 +50,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// # Examples /// /// ``` - /// # #![allow(unused_mut)] + /// # #![allow(unused_mut)] /// let mut foo: Foo = Foo::new(); /// ``` pub const fn new() -> Foo { diff --git a/crates/ra_ide/test_data/highlighting.html b/crates/ra_ide/test_data/highlighting.html index 182a3817a..345a2f023 100644 --- a/crates/ra_ide/test_data/highlighting.html +++ b/crates/ra_ide/test_data/highlighting.html @@ -35,7 +35,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } -
#[derive(Clone, Debug)]
+
#[derive(Clone, Debug)]
 struct Foo {
     pub x: i32,
     pub y: i32,
-- 
cgit v1.2.3