mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Color for
as a regular keyword when it's part of impl _ for _
This commit is contained in:
parent
3f1c73633e
commit
63b75a40c8
3 changed files with 28 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue