diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 8abaccd253..92211e9e3a 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -703,24 +703,7 @@ fn highlight_name_ref_by_syntax( }; match parent.kind() { - EXTERN_CRATE => { - let mut h: Highlight = HlTag::Symbol(SymbolKind::Module).into(); - let is_crate_root = if let Some(extern_crate) = ast::ExternCrate::cast(parent.clone()) { - if let Some(first_segment) = extern_crate.name_ref() { - first_segment.syntax().text() == name.syntax().text() - } else { - false - } - } else { - false - }; - - if is_crate_root { - h |= HlMod::CrateRoot; - } - - h | HlMod::Library - } + EXTERN_CRATE => (HlTag::Symbol(SymbolKind::Module) | HlMod::CrateRoot).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/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html index 9a55f7d01b..eb77c14c2a 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html @@ -52,12 +52,12 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd //! ```rust //! extern crate self; -//! extern crate std; -//! extern crate core; -//! extern crate alloc; -//! extern crate proc_macro; -//! extern crate test; -//! extern crate Krate; +//! extern crate std; +//! extern crate core; +//! extern crate alloc; +//! extern crate proc_macro; +//! extern crate test; +//! extern crate Krate; //! ``` mod outline_module;