mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Add ExternCrateDecl to HIR
This commit is contained in:
parent
151c750dac
commit
bcff166b3a
39 changed files with 585 additions and 167 deletions
|
@ -9,7 +9,7 @@ use either::Either;
|
|||
use hir::{db::DefDatabase, HasSource, LangItem, Semantics};
|
||||
use ide_db::{
|
||||
base_db::FileRange,
|
||||
defs::{Definition, IdentClass, OperatorClass},
|
||||
defs::{Definition, IdentClass, NameRefClass, OperatorClass},
|
||||
famous_defs::FamousDefs,
|
||||
helpers::pick_best_token,
|
||||
FxIndexSet, RootDatabase,
|
||||
|
@ -186,7 +186,20 @@ fn hover_simple(
|
|||
// rendering poll is very confusing
|
||||
return None;
|
||||
}
|
||||
Some(class.definitions().into_iter().zip(iter::once(node).cycle()))
|
||||
if let IdentClass::NameRefClass(NameRefClass::ExternCrateShorthand {
|
||||
decl,
|
||||
..
|
||||
}) = class
|
||||
{
|
||||
return Some(vec![(Definition::ExternCrateDecl(decl), node)]);
|
||||
}
|
||||
Some(
|
||||
class
|
||||
.definitions()
|
||||
.into_iter()
|
||||
.zip(iter::once(node).cycle())
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
})
|
||||
.flatten()
|
||||
.unique_by(|&(def, _)| def)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue