diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide/src/snapshots/highlighting.html | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/snapshots/rainbow_highlighting.html | 1 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 11 |
3 files changed, 10 insertions, 6 deletions
diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html index 2157139f6..a097cf8e8 100644 --- a/crates/ra_ide/src/snapshots/highlighting.html +++ b/crates/ra_ide/src/snapshots/highlighting.html | |||
@@ -5,6 +5,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
5 | 5 | ||
6 | .comment { color: #7F9F7F; } | 6 | .comment { color: #7F9F7F; } |
7 | .string { color: #CC9393; } | 7 | .string { color: #CC9393; } |
8 | .field { color: #94BFF3; } | ||
8 | .function { color: #93E0E3; } | 9 | .function { color: #93E0E3; } |
9 | .parameter { color: #94BFF3; } | 10 | .parameter { color: #94BFF3; } |
10 | .text { color: #DCDCCC; } | 11 | .text { color: #DCDCCC; } |
@@ -39,7 +40,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
39 | 40 | ||
40 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable.mut">vec</span> = <span class="text">Vec</span>::<span class="text">new</span>(); | 41 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable.mut">vec</span> = <span class="text">Vec</span>::<span class="text">new</span>(); |
41 | <span class="keyword.control">if</span> <span class="keyword">true</span> { | 42 | <span class="keyword.control">if</span> <span class="keyword">true</span> { |
42 | <span class="variable.mut">vec</span>.<span class="text">push</span>(<span class="type">Foo</span> { <span class="field">x</span>: <span class="literal.numeric">0</span>, <span class="field">y</span>: <span class="literal.numeric">1</span> }); | 43 | <span class="keyword">let</span> <span class="variable">x</span> = <span class="literal.numeric">92</span>; |
44 | <span class="variable.mut">vec</span>.<span class="text">push</span>(<span class="type">Foo</span> { <span class="field">x</span>, <span class="field">y</span>: <span class="literal.numeric">1</span> }); | ||
43 | } | 45 | } |
44 | <span class="keyword.unsafe">unsafe</span> { <span class="variable.mut">vec</span>.<span class="text">set_len</span>(<span class="literal.numeric">0</span>); } | 46 | <span class="keyword.unsafe">unsafe</span> { <span class="variable.mut">vec</span>.<span class="text">set_len</span>(<span class="literal.numeric">0</span>); } |
45 | 47 | ||
diff --git a/crates/ra_ide/src/snapshots/rainbow_highlighting.html b/crates/ra_ide/src/snapshots/rainbow_highlighting.html index 871a52cf6..110556c09 100644 --- a/crates/ra_ide/src/snapshots/rainbow_highlighting.html +++ b/crates/ra_ide/src/snapshots/rainbow_highlighting.html | |||
@@ -5,6 +5,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
5 | 5 | ||
6 | .comment { color: #7F9F7F; } | 6 | .comment { color: #7F9F7F; } |
7 | .string { color: #CC9393; } | 7 | .string { color: #CC9393; } |
8 | .field { color: #94BFF3; } | ||
8 | .function { color: #93E0E3; } | 9 | .function { color: #93E0E3; } |
9 | .parameter { color: #94BFF3; } | 10 | .parameter { color: #94BFF3; } |
10 | .text { color: #DCDCCC; } | 11 | .text { color: #DCDCCC; } |
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 15e75709c..657c7b21a 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -102,11 +102,10 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa | |||
102 | COMMENT => tags::LITERAL_COMMENT, | 102 | COMMENT => tags::LITERAL_COMMENT, |
103 | STRING | RAW_STRING | RAW_BYTE_STRING | BYTE_STRING => tags::LITERAL_STRING, | 103 | STRING | RAW_STRING | RAW_BYTE_STRING | BYTE_STRING => tags::LITERAL_STRING, |
104 | ATTR => tags::LITERAL_ATTRIBUTE, | 104 | ATTR => tags::LITERAL_ATTRIBUTE, |
105 | // Special-case field init shorthand | ||
106 | NAME_REF if node.parent().and_then(ast::RecordField::cast).is_some() => tags::FIELD, | ||
107 | NAME_REF if node.ancestors().any(|it| it.kind() == ATTR) => continue, | ||
105 | NAME_REF => { | 108 | NAME_REF => { |
106 | if node.ancestors().any(|it| it.kind() == ATTR) { | ||
107 | continue; | ||
108 | } | ||
109 | |||
110 | let name_ref = node.as_node().cloned().and_then(ast::NameRef::cast).unwrap(); | 109 | let name_ref = node.as_node().cloned().and_then(ast::NameRef::cast).unwrap(); |
111 | let name_kind = | 110 | let name_kind = |
112 | classify_name_ref(db, InFile::new(file_id.into(), &name_ref)).map(|d| d.kind); | 111 | classify_name_ref(db, InFile::new(file_id.into(), &name_ref)).map(|d| d.kind); |
@@ -282,6 +281,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
282 | 281 | ||
283 | .comment { color: #7F9F7F; } | 282 | .comment { color: #7F9F7F; } |
284 | .string { color: #CC9393; } | 283 | .string { color: #CC9393; } |
284 | .field { color: #94BFF3; } | ||
285 | .function { color: #93E0E3; } | 285 | .function { color: #93E0E3; } |
286 | .parameter { color: #94BFF3; } | 286 | .parameter { color: #94BFF3; } |
287 | .text { color: #DCDCCC; } | 287 | .text { color: #DCDCCC; } |
@@ -327,7 +327,8 @@ fn main() { | |||
327 | 327 | ||
328 | let mut vec = Vec::new(); | 328 | let mut vec = Vec::new(); |
329 | if true { | 329 | if true { |
330 | vec.push(Foo { x: 0, y: 1 }); | 330 | let x = 92; |
331 | vec.push(Foo { x, y: 1 }); | ||
331 | } | 332 | } |
332 | unsafe { vec.set_len(0); } | 333 | unsafe { vec.set_len(0); } |
333 | 334 | ||