Color for as a regular keyword when it's part of impl _ for _

This commit is contained in:
George Fraser 2020-05-10 11:26:19 -07:00
parent 3f1c73633e
commit 63b75a40c8
3 changed files with 28 additions and 1 deletions

View file

@ -403,13 +403,13 @@ fn highlight_element(
T![break]
| T![continue]
| T![else]
| T![for]
| T![if]
| T![loop]
| T![match]
| T![return]
| T![while]
| T![in] => h | HighlightModifier::ControlFlow,
T![for] if !is_child_of_impl(element) => h | HighlightModifier::ControlFlow,
T![unsafe] => h | HighlightModifier::Unsafe,
_ => h,
}
@ -433,6 +433,13 @@ fn highlight_element(
}
}
fn is_child_of_impl(element: SyntaxElement) -> bool {
match element.parent() {
Some(e) => e.kind() == IMPL_DEF,
_ => false,
}
}
fn highlight_name(db: &RootDatabase, def: Definition) -> Highlight {
match def {
Definition::Macro(_) => HighlightTag::Macro,