diff options
author | Aramis Razzaghipour <[email protected]> | 2021-05-24 04:15:54 +0100 |
---|---|---|
committer | Aramis Razzaghipour <[email protected]> | 2021-05-24 05:54:16 +0100 |
commit | b4cddc0705665f549b7feaf9899d91cd6ced4931 (patch) | |
tree | 59156578df19b5610ca1c28134445dd7587ef8c7 /crates/ide | |
parent | c32428571c3fbf12bd4a4187c797488355416a18 (diff) |
Highlight foreign modules as such
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/syntax_highlighting/highlight.rs | 10 |
1 files changed, 9 insertions, 1 deletions
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<hir::Crate>, def: Definition) | |||
303 | return h; | 303 | return h; |
304 | } | 304 | } |
305 | Definition::ModuleDef(def) => match def { | 305 | Definition::ModuleDef(def) => match def { |
306 | hir::ModuleDef::Module(_) => HlTag::Symbol(SymbolKind::Module), | 306 | hir::ModuleDef::Module(module) => { |
307 | let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Module)); | ||
308 | |||
309 | if Some(module.krate()) != krate { | ||
310 | h |= HlMod::Foreign; | ||
311 | } | ||
312 | |||
313 | return h; | ||
314 | } | ||
307 | hir::ModuleDef::Function(func) => { | 315 | hir::ModuleDef::Function(func) => { |
308 | let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Function)); | 316 | let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Function)); |
309 | if let Some(item) = func.as_assoc_item(db) { | 317 | if let Some(item) = func.as_assoc_item(db) { |