Highlight foreign modules as such

This commit is contained in:
Aramis Razzaghipour
2021-05-24 13:15:54 +10:00
parent c32428571c
commit b4cddc0705

View File

@@ -303,7 +303,15 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition)
return h;
}
Definition::ModuleDef(def) => match def {
hir::ModuleDef::Module(_) => HlTag::Symbol(SymbolKind::Module),
hir::ModuleDef::Module(module) => {
let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Module));
if Some(module.krate()) != krate {
h |= HlMod::Foreign;
}
return h;
}
hir::ModuleDef::Function(func) => {
let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Function));
if let Some(item) = func.as_assoc_item(db) {