Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/syntax_highlighting.rs')
| -rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index d67f6baff0..7d92c5051b 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs @@ -237,6 +237,20 @@ fn traverse( continue; } Some(item) if sema.is_attr_macro_call(&item) => current_attr_call = Some(item), + Some(item) if current_attr_call.is_none() => { + let adt = match item { + ast::Item::Enum(it) => Some(ast::Adt::Enum(it)), + ast::Item::Struct(it) => Some(ast::Adt::Struct(it)), + ast::Item::Union(it) => Some(ast::Adt::Union(it)), + _ => None, + }; + match adt { + Some(adt) if sema.is_derive_annotated(&adt) => { + current_attr_call = Some(adt.into()); + } + _ => (), + } + } None if ast::Attr::can_cast(node.kind()) => inside_attribute = true, _ => (), }, |