diff options
author | Chetan Khilosiya <[email protected]> | 2021-04-08 20:30:35 +0100 |
---|---|---|
committer | Chetan Khilosiya <[email protected]> | 2021-04-08 20:30:35 +0100 |
commit | 4a9dd149aafe9845674bc4314efe5a5ead713dcd (patch) | |
tree | 19618e0f0591f168bee16ea5a735534462a66200 /crates/ide/src/syntax_highlighting | |
parent | 51e5316de57939a98e33504ac23344f14240b6dc (diff) |
8024: Added the trait modifier for assoc types.
Diffstat (limited to 'crates/ide/src/syntax_highlighting')
-rw-r--r-- | crates/ide/src/syntax_highlighting/highlight.rs | 14 |
1 files changed, 12 insertions, 2 deletions
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 { | |||
323 | hir::ModuleDef::Trait(_) => HlTag::Symbol(SymbolKind::Trait), | 323 | hir::ModuleDef::Trait(_) => HlTag::Symbol(SymbolKind::Trait), |
324 | hir::ModuleDef::TypeAlias(type_) => { | 324 | hir::ModuleDef::TypeAlias(type_) => { |
325 | let mut h = Highlight::new(HlTag::Symbol(SymbolKind::TypeAlias)); | 325 | let mut h = Highlight::new(HlTag::Symbol(SymbolKind::TypeAlias)); |
326 | if type_.as_assoc_item(db).is_some() { | 326 | if let Some(item) = type_.as_assoc_item(db) { |
327 | h |= HlMod::Associated | 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 | } | ||
328 | } | 338 | } |
329 | return h; | 339 | return h; |
330 | } | 340 | } |