From 9634521abdde2ee609e3fa434e942149832a72fa Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 9 Nov 2020 18:06:54 +0100 Subject: . is an operator closes #6498 --- crates/ide/src/syntax_highlighting.rs | 4 ++- .../test_data/highlight_doctest.html | 6 ++--- .../test_data/highlight_unsafe.html | 12 ++++----- .../test_data/highlighting.html | 30 +++++++++++----------- .../test_data/rainbow_highlighting.html | 6 ++--- 5 files changed, 30 insertions(+), 28 deletions(-) diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index 05bafe9c8..37ab7a8f6 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs @@ -557,7 +557,9 @@ fn highlight_element( h } } - T![::] | T![->] | T![=>] | T![..] | T![=] | T![@] => HighlightTag::Operator.into(), + T![::] | T![->] | T![=>] | T![..] | T![=] | T![@] | T![.] => { + HighlightTag::Operator.into() + } T![!] if element.parent().and_then(ast::MacroCall::cast).is_some() => { HighlightTag::Macro.into() } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html index 6322d404f..f44fe457d 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html @@ -67,9 +67,9 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// let foo = Foo::new(); /// /// // calls bar on foo - /// assert!(foo.bar()); + /// assert!(foo.bar()); /// - /// let bar = foo.bar || Foo::bar; + /// let bar = foo.bar || Foo::bar; /// /// /* multi-line /// comment */ @@ -81,7 +81,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// ``` /// /// ```rust,no_run - /// let foobar = Foo::new().bar(); + /// let foobar = Foo::new().bar(); /// ``` /// /// ```sh diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html b/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html index 552fea668..4b6d6adc9 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html @@ -73,27 +73,27 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd unsafe { // unsafe fn and method calls unsafe_fn(); - let b = u.b; + let b = u.b; match u { Union { b: 0 } => (), Union { a } => (), } - HasUnsafeFn.unsafe_method(); + HasUnsafeFn.unsafe_method(); // unsafe deref let y = *x; // unsafe access to a static mut - let a = global_mut.a; + let a = global_mut.a; // unsafe ref of packed fields let packed = Packed { a: 0 }; - let a = &packed.a; - let ref a = packed.a; + let a = &packed.a; + let ref a = packed.a; let Packed { ref a } = packed; let Packed { a: ref _a } = packed; // unsafe auto ref of packed field - packed.a.calls_autoref(); + packed.a.calls_autoref(); } } \ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index 5eb222ee2..6a10a9dcd 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html @@ -67,21 +67,21 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd impl Bar for Foo { fn bar(&self) -> i32 { - self.x + self.x } } impl Foo { fn baz(mut self, f: Foo) -> i32 { - f.baz(self) + f.baz(self) } fn qux(&mut self) { - self.x = 0; + self.x = 0; } fn quop(&self) -> i32 { - self.x + self.x } } @@ -92,15 +92,15 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd impl FooCopy { fn baz(self, f: FooCopy) -> u32 { - f.baz(self) + f.baz(self) } fn qux(&mut self) { - self.x = 0; + self.x = 0; } fn quop(&self) -> u32 { - self.x + self.x } } @@ -152,10 +152,10 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd let mut vec = Vec::new(); if true { let x = 92; - vec.push(Foo { x, y: 1 }); + vec.push(Foo { x, y: 1 }); } unsafe { - vec.set_len(0); + vec.set_len(0); STATIC_MUT = 1; } @@ -175,14 +175,14 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd let mut foo = Foo { x, y: x }; let foo2 = Foo { x, y: x }; - foo.quop(); - foo.qux(); - foo.baz(foo2); + foo.quop(); + foo.qux(); + foo.baz(foo2); let mut copy = FooCopy { x }; - copy.quop(); - copy.qux(); - copy.baz(copy); + copy.quop(); + copy.qux(); + copy.baz(copy); let a = |x| x; let bar = Foo::baz; diff --git a/crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html b/crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html index 401e87a73..c7589605f 100644 --- a/crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/rainbow_highlighting.html @@ -37,11 +37,11 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
fn main() {
     let hello = "hello";
-    let x = hello.to_string();
-    let y = hello.to_string();
+    let x = hello.to_string();
+    let y = hello.to_string();
 
     let x = "other color please!";
-    let y = x.to_string();
+    let y = x.to_string();
 }
 
 fn bar() {
-- 
cgit v1.2.3