From b4cddc0705665f549b7feaf9899d91cd6ced4931 Mon Sep 17 00:00:00 2001 From: Aramis Razzaghipour Date: Mon, 24 May 2021 13:15:54 +1000 Subject: Highlight foreign modules as such --- crates/ide/src/syntax_highlighting/highlight.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'crates') diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 574a14429..141536dcc 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -303,7 +303,15 @@ fn highlight_def(db: &RootDatabase, krate: Option, 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) { -- cgit v1.2.3