Skip to content

Commit 63726a9

Browse files
Merge #8431
8431: 8024: Added the trait highlight modifier for assoc types. r=Veykril a=chetankhilosiya Co-authored-by: Chetan Khilosiya <[email protected]>
2 parents 51e5316 + 4a9dd14 commit 63726a9

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

crates/ide/src/syntax_highlighting/highlight.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,18 @@ fn highlight_def(db: &RootDatabase, def: Definition) -> Highlight {
323323
hir::ModuleDef::Trait(_) => HlTag::Symbol(SymbolKind::Trait),
324324
hir::ModuleDef::TypeAlias(type_) => {
325325
let mut h = Highlight::new(HlTag::Symbol(SymbolKind::TypeAlias));
326-
if type_.as_assoc_item(db).is_some() {
327-
h |= HlMod::Associated
326+
if let Some(item) = type_.as_assoc_item(db) {
327+
h |= HlMod::Associated;
328+
match item.container(db) {
329+
AssocItemContainer::Impl(i) => {
330+
if i.trait_(db).is_some() {
331+
h |= HlMod::Trait;
332+
}
333+
}
334+
AssocItemContainer::Trait(_t) => {
335+
h |= HlMod::Trait;
336+
}
337+
}
328338
}
329339
return h;
330340
}

0 commit comments

Comments
 (0)