diff --git a/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs b/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs
index 479c0b381a4b..c6e11b9cbdf7 100644
--- a/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/highlight.rs
@@ -703,6 +703,7 @@ fn highlight_name_ref_by_syntax(
};
match parent.kind() {
+ EXTERN_CRATE => HlTag::Symbol(SymbolKind::Module).into(),
METHOD_CALL_EXPR => ast::MethodCallExpr::cast(parent)
.and_then(|it| highlight_method_call(sema, krate, &it, edition))
.unwrap_or_else(|| SymbolKind::Method.into()),
diff --git a/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html b/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html
index 5ff96ae2a74f..2f7bc65d14bb 100644
--- a/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html
+++ b/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html
@@ -50,6 +50,9 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
fn test() {}
+
+extern crate Krate;
+
mod outline_module;
diff --git a/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/tests.rs b/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/tests.rs
index b9520ae2bba2..ad3d47639111 100644
--- a/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/tests.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/syntax_highlighting/tests.rs
@@ -722,6 +722,9 @@ fn test_highlight_doc_comment() {
//! fn test() {}
//! ```
+//! ```rust
+//! extern crate Krate;
+//! ```
mod outline_module;
/// ```