From 4a9dd149aafe9845674bc4314efe5a5ead713dcd Mon Sep 17 00:00:00 2001 From: Chetan Khilosiya Date: Fri, 9 Apr 2021 01:00:35 +0530 Subject: 8024: Added the trait modifier for assoc types. --- crates/ide/src/syntax_highlighting/highlight.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'crates') diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 5ccb84714..e921784bf 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -323,8 +323,18 @@ fn highlight_def(db: &RootDatabase, def: Definition) -> Highlight { hir::ModuleDef::Trait(_) => HlTag::Symbol(SymbolKind::Trait), hir::ModuleDef::TypeAlias(type_) => { let mut h = Highlight::new(HlTag::Symbol(SymbolKind::TypeAlias)); - if type_.as_assoc_item(db).is_some() { - h |= HlMod::Associated + if let Some(item) = type_.as_assoc_item(db) { + h |= HlMod::Associated; + match item.container(db) { + AssocItemContainer::Impl(i) => { + if i.trait_(db).is_some() { + h |= HlMod::Trait; + } + } + AssocItemContainer::Trait(_t) => { + h |= HlMod::Trait; + } + } } return h; } -- cgit v1.2.3