diff options
author | George Fraser <[email protected]> | 2020-05-10 19:08:32 +0100 |
---|---|---|
committer | George Fraser <[email protected]> | 2020-05-10 21:07:28 +0100 |
commit | 3f1c73633eb3e5d8a2df3a72dc772087cfb18be4 (patch) | |
tree | b70dbd08238f38dfb7fab482d5e543c87cddc26d | |
parent | 46566d7a791d758447980a03b13fd79a76c76a0f (diff) |
Color `in` as a control keyword
-rw-r--r-- | crates/ra_ide/src/snapshots/highlighting.html | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 3 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/tests.rs | 4 |
3 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html index 4c27aade4..c67df5c39 100644 --- a/crates/ra_ide/src/snapshots/highlighting.html +++ b/crates/ra_ide/src/snapshots/highlighting.html | |||
@@ -63,6 +63,10 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
63 | <span class="static mutable">STATIC_MUT</span> = <span class="numeric_literal">1</span>; | 63 | <span class="static mutable">STATIC_MUT</span> = <span class="numeric_literal">1</span>; |
64 | } | 64 | } |
65 | 65 | ||
66 | <span class="keyword control">for</span> <span class="variable declaration">e</span> <span class="keyword control">in</span> <span class="variable mutable">vec</span> { | ||
67 | <span class="comment">// Do nothing</span> | ||
68 | } | ||
69 | |||
66 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">x</span> = <span class="numeric_literal">42</span>; | 70 | <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">x</span> = <span class="numeric_literal">42</span>; |
67 | <span class="keyword">let</span> <span class="variable declaration mutable">y</span> = &<span class="keyword">mut</span> <span class="variable mutable">x</span>; | 71 | <span class="keyword">let</span> <span class="variable declaration mutable">y</span> = &<span class="keyword">mut</span> <span class="variable mutable">x</span>; |
68 | <span class="keyword">let</span> <span class="variable declaration">z</span> = &<span class="variable mutable">y</span>; | 72 | <span class="keyword">let</span> <span class="variable declaration">z</span> = &<span class="variable mutable">y</span>; |
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index d53a39f57..16123c5cb 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -408,7 +408,8 @@ fn highlight_element( | |||
408 | | T![loop] | 408 | | T![loop] |
409 | | T![match] | 409 | | T![match] |
410 | | T![return] | 410 | | T![return] |
411 | | T![while] => h | HighlightModifier::ControlFlow, | 411 | | T![while] |
412 | | T![in] => h | HighlightModifier::ControlFlow, | ||
412 | T![unsafe] => h | HighlightModifier::Unsafe, | 413 | T![unsafe] => h | HighlightModifier::Unsafe, |
413 | _ => h, | 414 | _ => h, |
414 | } | 415 | } |
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs index 13894869c..7975755b2 100644 --- a/crates/ra_ide/src/syntax_highlighting/tests.rs +++ b/crates/ra_ide/src/syntax_highlighting/tests.rs | |||
@@ -47,6 +47,10 @@ fn main() { | |||
47 | STATIC_MUT = 1; | 47 | STATIC_MUT = 1; |
48 | } | 48 | } |
49 | 49 | ||
50 | for e in vec { | ||
51 | // Do nothing | ||
52 | } | ||
53 | |||
50 | let mut x = 42; | 54 | let mut x = 42; |
51 | let y = &mut x; | 55 | let y = &mut x; |
52 | let z = &y; | 56 | let z = &y; |