diff options
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/snapshots/highlight_injection.html | 1 | ||||
-rw-r--r-- | crates/ra_ide/src/snapshots/highlight_strings.html | 1 | ||||
-rw-r--r-- | crates/ra_ide/src/snapshots/highlighting.html | 3 | ||||
-rw-r--r-- | crates/ra_ide/src/snapshots/rainbow_highlighting.html | 1 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 31 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/html.rs | 1 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/tags.rs | 2 |
7 files changed, 28 insertions, 12 deletions
diff --git a/crates/ra_ide/src/snapshots/highlight_injection.html b/crates/ra_ide/src/snapshots/highlight_injection.html index ea026d7a0..68fc589bc 100644 --- a/crates/ra_ide/src/snapshots/highlight_injection.html +++ b/crates/ra_ide/src/snapshots/highlight_injection.html | |||
@@ -17,6 +17,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
17 | .type_param { color: #DFAF8F; } | 17 | .type_param { color: #DFAF8F; } |
18 | .attribute { color: #94BFF3; } | 18 | .attribute { color: #94BFF3; } |
19 | .numeric_literal { color: #BFEBBF; } | 19 | .numeric_literal { color: #BFEBBF; } |
20 | .bool_literal { color: #BFE6EB; } | ||
20 | .macro { color: #94BFF3; } | 21 | .macro { color: #94BFF3; } |
21 | .module { color: #AFD8AF; } | 22 | .module { color: #AFD8AF; } |
22 | .variable { color: #DCDCCC; } | 23 | .variable { color: #DCDCCC; } |
diff --git a/crates/ra_ide/src/snapshots/highlight_strings.html b/crates/ra_ide/src/snapshots/highlight_strings.html index 752b487e8..326744361 100644 --- a/crates/ra_ide/src/snapshots/highlight_strings.html +++ b/crates/ra_ide/src/snapshots/highlight_strings.html | |||
@@ -17,6 +17,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
17 | .type_param { color: #DFAF8F; } | 17 | .type_param { color: #DFAF8F; } |
18 | .attribute { color: #94BFF3; } | 18 | .attribute { color: #94BFF3; } |
19 | .numeric_literal { color: #BFEBBF; } | 19 | .numeric_literal { color: #BFEBBF; } |
20 | .bool_literal { color: #BFE6EB; } | ||
20 | .macro { color: #94BFF3; } | 21 | .macro { color: #94BFF3; } |
21 | .module { color: #AFD8AF; } | 22 | .module { color: #AFD8AF; } |
22 | .variable { color: #DCDCCC; } | 23 | .variable { color: #DCDCCC; } |
diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html index 2ceadf2fc..198139220 100644 --- a/crates/ra_ide/src/snapshots/highlighting.html +++ b/crates/ra_ide/src/snapshots/highlighting.html | |||
@@ -17,6 +17,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
17 | .type_param { color: #DFAF8F; } | 17 | .type_param { color: #DFAF8F; } |
18 | .attribute { color: #94BFF3; } | 18 | .attribute { color: #94BFF3; } |
19 | .numeric_literal { color: #BFEBBF; } | 19 | .numeric_literal { color: #BFEBBF; } |
20 | .bool_literal { color: #BFE6EB; } | ||
20 | .macro { color: #94BFF3; } | 21 | .macro { color: #94BFF3; } |
21 | .module { color: #AFD8AF; } | 22 | .module { color: #AFD8AF; } |
22 | .variable { color: #DCDCCC; } | 23 | .variable { color: #DCDCCC; } |
@@ -64,7 +65,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
64 | <span class="macro">println!</span>(<span class="string_literal">"Hello, {}!"</span>, <span class="numeric_literal">92</span>); | 65 | <span class="macro">println!</span>(<span class="string_literal">"Hello, {}!"</span>, <span class="numeric_literal">92</span>); |
65 | 66 | ||
66 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">vec</span> = <span class="unresolved_reference">Vec</span>::<span class="unresolved_reference">new</span>(); | 67 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">vec</span> = <span class="unresolved_reference">Vec</span>::<span class="unresolved_reference">new</span>(); |
67 | <span class="keyword control">if</span> <span class="keyword">true</span> { | 68 | <span class="keyword control">if</span> <span class="bool_literal">true</span> { |
68 | <span class="keyword">let</span> <span class="variable declaration">x</span> = <span class="numeric_literal">92</span>; | 69 | <span class="keyword">let</span> <span class="variable declaration">x</span> = <span class="numeric_literal">92</span>; |
69 | <span class="variable mutable">vec</span>.<span class="unresolved_reference">push</span>(<span class="struct">Foo</span> { <span class="field">x</span>, <span class="field">y</span>: <span class="numeric_literal">1</span> }); | 70 | <span class="variable mutable">vec</span>.<span class="unresolved_reference">push</span>(<span class="struct">Foo</span> { <span class="field">x</span>, <span class="field">y</span>: <span class="numeric_literal">1</span> }); |
70 | } | 71 | } |
diff --git a/crates/ra_ide/src/snapshots/rainbow_highlighting.html b/crates/ra_ide/src/snapshots/rainbow_highlighting.html index 11e1f3e44..2a0294f71 100644 --- a/crates/ra_ide/src/snapshots/rainbow_highlighting.html +++ b/crates/ra_ide/src/snapshots/rainbow_highlighting.html | |||
@@ -17,6 +17,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
17 | .type_param { color: #DFAF8F; } | 17 | .type_param { color: #DFAF8F; } |
18 | .attribute { color: #94BFF3; } | 18 | .attribute { color: #94BFF3; } |
19 | .numeric_literal { color: #BFEBBF; } | 19 | .numeric_literal { color: #BFEBBF; } |
20 | .bool_literal { color: #BFE6EB; } | ||
20 | .macro { color: #94BFF3; } | 21 | .macro { color: #94BFF3; } |
21 | .module { color: #AFD8AF; } | 22 | .module { color: #AFD8AF; } |
22 | .variable { color: #DCDCCC; } | 23 | .variable { color: #DCDCCC; } |
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index b55cf748d..61aeb28cb 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -413,6 +413,7 @@ fn highlight_element( | |||
413 | | T![in] => h | HighlightModifier::ControlFlow, | 413 | | T![in] => h | HighlightModifier::ControlFlow, |
414 | T![for] if !is_child_of_impl(element) => h | HighlightModifier::ControlFlow, | 414 | T![for] if !is_child_of_impl(element) => h | HighlightModifier::ControlFlow, |
415 | T![unsafe] => h | HighlightModifier::Unsafe, | 415 | T![unsafe] => h | HighlightModifier::Unsafe, |
416 | T![true] | T![false] => HighlightTag::BoolLiteral.into(), | ||
416 | _ => h, | 417 | _ => h, |
417 | } | 418 | } |
418 | } | 419 | } |
@@ -480,23 +481,31 @@ fn highlight_name(db: &RootDatabase, def: Definition) -> Highlight { | |||
480 | } | 481 | } |
481 | 482 | ||
482 | fn highlight_name_by_syntax(name: ast::Name) -> Highlight { | 483 | fn highlight_name_by_syntax(name: ast::Name) -> Highlight { |
483 | let default = HighlightTag::Function.into(); | 484 | let default = HighlightTag::UnresolvedReference; |
484 | 485 | ||
485 | let parent = match name.syntax().parent() { | 486 | let parent = match name.syntax().parent() { |
486 | Some(it) => it, | 487 | Some(it) => it, |
487 | _ => return default, | 488 | _ => return default.into(), |
488 | }; | 489 | }; |
489 | 490 | ||
490 | match parent.kind() { | 491 | let tag = match parent.kind() { |
491 | STRUCT_DEF => HighlightTag::Struct.into(), | 492 | STRUCT_DEF => HighlightTag::Struct, |
492 | ENUM_DEF => HighlightTag::Enum.into(), | 493 | ENUM_DEF => HighlightTag::Enum, |
493 | UNION_DEF => HighlightTag::Union.into(), | 494 | UNION_DEF => HighlightTag::Union, |
494 | TRAIT_DEF => HighlightTag::Trait.into(), | 495 | TRAIT_DEF => HighlightTag::Trait, |
495 | TYPE_ALIAS_DEF => HighlightTag::TypeAlias.into(), | 496 | TYPE_ALIAS_DEF => HighlightTag::TypeAlias, |
496 | TYPE_PARAM => HighlightTag::TypeParam.into(), | 497 | TYPE_PARAM => HighlightTag::TypeParam, |
497 | RECORD_FIELD_DEF => HighlightTag::Field.into(), | 498 | RECORD_FIELD_DEF => HighlightTag::Field, |
499 | MODULE => HighlightTag::Module, | ||
500 | FN_DEF => HighlightTag::Function, | ||
501 | CONST_DEF => HighlightTag::Constant, | ||
502 | STATIC_DEF => HighlightTag::Static, | ||
503 | ENUM_VARIANT => HighlightTag::EnumVariant, | ||
504 | BIND_PAT => HighlightTag::Local, | ||
498 | _ => default, | 505 | _ => default, |
499 | } | 506 | }; |
507 | |||
508 | tag.into() | ||
500 | } | 509 | } |
501 | 510 | ||
502 | fn highlight_injection( | 511 | fn highlight_injection( |
diff --git a/crates/ra_ide/src/syntax_highlighting/html.rs b/crates/ra_ide/src/syntax_highlighting/html.rs index ff0eeeb52..edfe61f39 100644 --- a/crates/ra_ide/src/syntax_highlighting/html.rs +++ b/crates/ra_ide/src/syntax_highlighting/html.rs | |||
@@ -76,6 +76,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
76 | .type_param { color: #DFAF8F; } | 76 | .type_param { color: #DFAF8F; } |
77 | .attribute { color: #94BFF3; } | 77 | .attribute { color: #94BFF3; } |
78 | .numeric_literal { color: #BFEBBF; } | 78 | .numeric_literal { color: #BFEBBF; } |
79 | .bool_literal { color: #BFE6EB; } | ||
79 | .macro { color: #94BFF3; } | 80 | .macro { color: #94BFF3; } |
80 | .module { color: #AFD8AF; } | 81 | .module { color: #AFD8AF; } |
81 | .variable { color: #DCDCCC; } | 82 | .variable { color: #DCDCCC; } |
diff --git a/crates/ra_ide/src/syntax_highlighting/tags.rs b/crates/ra_ide/src/syntax_highlighting/tags.rs index 33e6619ec..09652a5b1 100644 --- a/crates/ra_ide/src/syntax_highlighting/tags.rs +++ b/crates/ra_ide/src/syntax_highlighting/tags.rs | |||
@@ -15,6 +15,7 @@ pub struct HighlightModifiers(u32); | |||
15 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] | 15 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] |
16 | pub enum HighlightTag { | 16 | pub enum HighlightTag { |
17 | Attribute, | 17 | Attribute, |
18 | BoolLiteral, | ||
18 | BuiltinType, | 19 | BuiltinType, |
19 | ByteLiteral, | 20 | ByteLiteral, |
20 | CharLiteral, | 21 | CharLiteral, |
@@ -60,6 +61,7 @@ impl HighlightTag { | |||
60 | fn as_str(self) -> &'static str { | 61 | fn as_str(self) -> &'static str { |
61 | match self { | 62 | match self { |
62 | HighlightTag::Attribute => "attribute", | 63 | HighlightTag::Attribute => "attribute", |
64 | HighlightTag::BoolLiteral => "bool_literal", | ||
63 | HighlightTag::BuiltinType => "builtin_type", | 65 | HighlightTag::BuiltinType => "builtin_type", |
64 | HighlightTag::ByteLiteral => "byte_literal", | 66 | HighlightTag::ByteLiteral => "byte_literal", |
65 | HighlightTag::CharLiteral => "char_literal", | 67 | HighlightTag::CharLiteral => "char_literal", |