]> git.lizzy.rs Git - rust.git/commitdiff
Highlight foreign modules as such
authorAramis Razzaghipour <aramisnoah@gmail.com>
Mon, 24 May 2021 03:15:54 +0000 (13:15 +1000)
committerAramis Razzaghipour <aramisnoah@gmail.com>
Mon, 24 May 2021 04:54:16 +0000 (14:54 +1000)
crates/ide/src/syntax_highlighting/highlight.rs

index 574a14429722120a67854fdac8e757a2810c5bf4..141536dcc89da4ea97c399eb90b987a881ebf9af 100644 (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) {