aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorMatthew Jasper <[email protected]>2020-05-21 17:40:52 +0100
committerMatthew Jasper <[email protected]>2020-05-24 15:12:17 +0100
commite2d36cb692f042f2051a8a88d271a297a3d333a4 (patch)
treed1a0e14c800398d6142438696200992cceaf6af1 /crates
parent7e862626cc892662c3c95ba393483ac89c07e31a (diff)
Highlight `true` and `false` as literals
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide/src/snapshots/highlight_injection.html1
-rw-r--r--crates/ra_ide/src/snapshots/highlight_strings.html1
-rw-r--r--crates/ra_ide/src/snapshots/highlighting.html3
-rw-r--r--crates/ra_ide/src/snapshots/rainbow_highlighting.html1
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs1
-rw-r--r--crates/ra_ide/src/syntax_highlighting/html.rs1
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tags.rs2
-rw-r--r--crates/rust-analyzer/src/semantic_tokens.rs1
-rw-r--r--crates/rust-analyzer/src/to_proto.rs1
9 files changed, 11 insertions, 1 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..5f20fae80 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 }
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)]
16pub enum HighlightTag { 16pub 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",
diff --git a/crates/rust-analyzer/src/semantic_tokens.rs b/crates/rust-analyzer/src/semantic_tokens.rs
index 90a6257ee..9b775871f 100644
--- a/crates/rust-analyzer/src/semantic_tokens.rs
+++ b/crates/rust-analyzer/src/semantic_tokens.rs
@@ -36,6 +36,7 @@ macro_rules! define_semantic_token_types {
36 36
37define_semantic_token_types![ 37define_semantic_token_types![
38 (ATTRIBUTE, "attribute"), 38 (ATTRIBUTE, "attribute"),
39 (BOOLEAN, "boolean"),
39 (BUILTIN_TYPE, "builtinType"), 40 (BUILTIN_TYPE, "builtinType"),
40 (ENUM_MEMBER, "enumMember"), 41 (ENUM_MEMBER, "enumMember"),
41 (LIFETIME, "lifetime"), 42 (LIFETIME, "lifetime"),
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 672e47e41..81a347247 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -295,6 +295,7 @@ fn semantic_token_type_and_modifiers(
295 HighlightTag::ByteLiteral | HighlightTag::NumericLiteral => { 295 HighlightTag::ByteLiteral | HighlightTag::NumericLiteral => {
296 lsp_types::SemanticTokenType::NUMBER 296 lsp_types::SemanticTokenType::NUMBER
297 } 297 }
298 HighlightTag::BoolLiteral => semantic_tokens::BOOLEAN,
298 HighlightTag::CharLiteral | HighlightTag::StringLiteral => { 299 HighlightTag::CharLiteral | HighlightTag::StringLiteral => {
299 lsp_types::SemanticTokenType::STRING 300 lsp_types::SemanticTokenType::STRING
300 } 301 }