From 9464ca97c90dca4cad57d29cac4fccdd99235925 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Feb 2020 14:47:33 +0100 Subject: Fix highlighting test --- crates/ra_ide/src/snapshots/highlighting.html | 54 +++++++++++----------- .../ra_ide/src/snapshots/rainbow_highlighting.html | 26 ++++++----- crates/ra_ide/src/syntax_highlighting/html.rs | 20 ++++---- crates/ra_ide/src/syntax_highlighting/tags.rs | 2 +- crates/ra_ide/src/syntax_highlighting/tests.rs | 2 +- 5 files changed, 55 insertions(+), 49 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html index 51851763e..8c372ad27 100644 --- a/crates/ra_ide/src/snapshots/highlighting.html +++ b/crates/ra_ide/src/snapshots/highlighting.html @@ -3,70 +3,72 @@ body { margin: 0; } pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } + .comment { color: #7F9F7F; } -.string { color: #CC9393; } +.struct, .enum { color: #7CB8BB; } +.enum_variant { color: #BDE0F3; } +.string_literal { color: #CC9393; } .field { color: #94BFF3; } .function { color: #93E0E3; } .parameter { color: #94BFF3; } .text { color: #DCDCCC; } .type { color: #7CB8BB; } -.type.builtin { color: #8CD0D3; } -.type.param { color: #20999D; } +.builtin_type { color: #8CD0D3; } +.type_param { color: #DFAF8F; } .attribute { color: #94BFF3; } -.literal { color: #BFEBBF; } -.literal.numeric { color: #6A8759; } +.numeric_literal { color: #BFEBBF; } .macro { color: #94BFF3; } .module { color: #AFD8AF; } .variable { color: #DCDCCC; } -.variable.mut { color: #DCDCCC; text-decoration: underline; } +.mutable { text-decoration: underline; } -.keyword { color: #F0DFAF; } -.keyword.unsafe { color: #DFAF8F; } -.keyword.control { color: #F0DFAF; font-weight: bold; } +.keyword { color: #F0DFAF; font-weight: bold; } +.keyword.unsafe { color: #BC8383; font-weight: bold; } +.control { font-style: italic; }
#[derive(Clone, Debug)]
-struct Foo {
-    pub x: i32,
-    pub y: i32,
+struct Foo {
+    pub x: i32,
+    pub y: i32,
 }
 
-fn foo<T>() -> T {
+fn foo<T>() -> T {
     unimplemented!();
-    foo::<i32>();
+    foo::<i32>();
 }
 
 macro_rules! def_fn {
     ($($tt:tt)*) => {$($tt)*}
 }
 
-def_fn!{
-    fn bar() -> u32 {
-        100
+def_fn! {
+    fn bar() -> u32 {
+        100
     }
 }
 
 // comment
 fn main() {
-    println!("Hello, {}!", 92);
+    println!("Hello, {}!", 92);
 
     let mut vec = Vec::new();
     if true {
-        let x = 92;
-        vec.push(Foo { x, y: 1 });
+        let x = 92;
+        vec.push(Foo { x, y: 1 });
     }
-    unsafe { vec.set_len(0); }
+    unsafe { vec.set_len(0); }
 
-    let mut x = 42;
+    let mut x = 42;
     let y = &mut x;
     let z = &y;
 
     y;
 }
 
-enum E<X> {
-    V(X)
+enum E<X> {
+    V(X)
 }
 
-impl<X> E<X> {
-    fn new<T>() -> E<T> {}
+impl<X> E<X> {
+    fn new<T>() -> E<T> {}
 }
\ No newline at end of file diff --git a/crates/ra_ide/src/snapshots/rainbow_highlighting.html b/crates/ra_ide/src/snapshots/rainbow_highlighting.html index 1f869867f..f63e64b6d 100644 --- a/crates/ra_ide/src/snapshots/rainbow_highlighting.html +++ b/crates/ra_ide/src/snapshots/rainbow_highlighting.html @@ -3,36 +3,38 @@ body { margin: 0; } pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } + .comment { color: #7F9F7F; } -.string { color: #CC9393; } +.struct, .enum { color: #7CB8BB; } +.enum_variant { color: #BDE0F3; } +.string_literal { color: #CC9393; } .field { color: #94BFF3; } .function { color: #93E0E3; } .parameter { color: #94BFF3; } .text { color: #DCDCCC; } .type { color: #7CB8BB; } -.type.builtin { color: #8CD0D3; } -.type.param { color: #20999D; } +.builtin_type { color: #8CD0D3; } +.type_param { color: #DFAF8F; } .attribute { color: #94BFF3; } -.literal { color: #BFEBBF; } -.literal.numeric { color: #6A8759; } +.numeric_literal { color: #BFEBBF; } .macro { color: #94BFF3; } .module { color: #AFD8AF; } .variable { color: #DCDCCC; } -.variable.mut { color: #DCDCCC; text-decoration: underline; } +.mutable { text-decoration: underline; } -.keyword { color: #F0DFAF; } -.keyword.unsafe { color: #DFAF8F; } -.keyword.control { color: #F0DFAF; font-weight: bold; } +.keyword { color: #F0DFAF; font-weight: bold; } +.keyword.unsafe { color: #BC8383; font-weight: bold; } +.control { font-style: italic; }
fn main() {
-    let hello = "hello";
+    let hello = "hello";
     let x = hello.to_string();
     let y = hello.to_string();
 
-    let x = "other color please!";
+    let x = "other color please!";
     let y = x.to_string();
 }
 
 fn bar() {
-    let mut hello = "hello";
+    let mut hello = "hello";
 }
\ No newline at end of file diff --git a/crates/ra_ide/src/syntax_highlighting/html.rs b/crates/ra_ide/src/syntax_highlighting/html.rs index 210d9a57b..54678c278 100644 --- a/crates/ra_ide/src/syntax_highlighting/html.rs +++ b/crates/ra_ide/src/syntax_highlighting/html.rs @@ -80,25 +80,27 @@ const STYLE: &str = " body { margin: 0; } pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } + .comment { color: #7F9F7F; } -.string { color: #CC9393; } +.struct, .enum { color: #7CB8BB; } +.enum_variant { color: #BDE0F3; } +.string_literal { color: #CC9393; } .field { color: #94BFF3; } .function { color: #93E0E3; } .parameter { color: #94BFF3; } .text { color: #DCDCCC; } .type { color: #7CB8BB; } -.type.builtin { color: #8CD0D3; } -.type.param { color: #20999D; } +.builtin_type { color: #8CD0D3; } +.type_param { color: #DFAF8F; } .attribute { color: #94BFF3; } -.literal { color: #BFEBBF; } -.literal.numeric { color: #6A8759; } +.numeric_literal { color: #BFEBBF; } .macro { color: #94BFF3; } .module { color: #AFD8AF; } .variable { color: #DCDCCC; } -.variable.mut { color: #DCDCCC; text-decoration: underline; } +.mutable { text-decoration: underline; } -.keyword { color: #F0DFAF; } -.keyword.unsafe { color: #DFAF8F; } -.keyword.control { color: #F0DFAF; font-weight: bold; } +.keyword { color: #F0DFAF; font-weight: bold; } +.keyword.unsafe { color: #BC8383; font-weight: bold; } +.control { font-style: italic; } "; diff --git a/crates/ra_ide/src/syntax_highlighting/tags.rs b/crates/ra_ide/src/syntax_highlighting/tags.rs index 0b12bdef5..9da80823c 100644 --- a/crates/ra_ide/src/syntax_highlighting/tags.rs +++ b/crates/ra_ide/src/syntax_highlighting/tags.rs @@ -72,7 +72,7 @@ impl HighlightTag { HighlightTag::NumericLiteral => "numeric_literal", HighlightTag::SelfType => "self_type", HighlightTag::Static => "static", - HighlightTag::StringLiteral => "string", + HighlightTag::StringLiteral => "string_literal", HighlightTag::Struct => "struct", HighlightTag::Trait => "trait", HighlightTag::TypeAlias => "type_alias", diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs index ff23d4ac5..2d90a072f 100644 --- a/crates/ra_ide/src/syntax_highlighting/tests.rs +++ b/crates/ra_ide/src/syntax_highlighting/tests.rs @@ -26,7 +26,7 @@ macro_rules! def_fn { ($($tt:tt)*) => {$($tt)*} } -def_fn!{ +def_fn! { fn bar() -> u32 { 100 } -- cgit v1.2.3