diff options
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting.rs')
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 16123c5cb..be57eeb0a 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -403,13 +403,13 @@ fn highlight_element( | |||
403 | T![break] | 403 | T![break] |
404 | | T![continue] | 404 | | T![continue] |
405 | | T![else] | 405 | | T![else] |
406 | | T![for] | ||
407 | | T![if] | 406 | | T![if] |
408 | | T![loop] | 407 | | T![loop] |
409 | | T![match] | 408 | | T![match] |
410 | | T![return] | 409 | | T![return] |
411 | | T![while] | 410 | | T![while] |
412 | | T![in] => h | HighlightModifier::ControlFlow, | 411 | | T![in] => h | HighlightModifier::ControlFlow, |
412 | T![for] if !is_child_of_impl(element) => h | HighlightModifier::ControlFlow, | ||
413 | T![unsafe] => h | HighlightModifier::Unsafe, | 413 | T![unsafe] => h | HighlightModifier::Unsafe, |
414 | _ => h, | 414 | _ => h, |
415 | } | 415 | } |
@@ -433,6 +433,13 @@ fn highlight_element( | |||
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
436 | fn is_child_of_impl(element: SyntaxElement) -> bool { | ||
437 | match element.parent() { | ||
438 | Some(e) => e.kind() == IMPL_DEF, | ||
439 | _ => false, | ||
440 | } | ||
441 | } | ||
442 | |||
436 | fn highlight_name(db: &RootDatabase, def: Definition) -> Highlight { | 443 | fn highlight_name(db: &RootDatabase, def: Definition) -> Highlight { |
437 | match def { | 444 | match def { |
438 | Definition::Macro(_) => HighlightTag::Macro, | 445 | Definition::Macro(_) => HighlightTag::Macro, |