feat: Make unqualified derive attributes flyimportable

This commit is contained in:
Lukas Wirth 2021-10-28 19:19:30 +02:00
parent 7fdbdc4ab2
commit ebd63ec1cf
11 changed files with 124 additions and 31 deletions

View file

@ -1623,7 +1623,12 @@ impl MacroDef {
pub fn name(self, db: &dyn HirDatabase) -> Option<Name> {
match self.source(db)?.value {
Either::Left(it) => it.name().map(|it| it.as_name()),
Either::Right(it) => it.name().map(|it| it.as_name()),
Either::Right(_) => {
let krate = self.id.krate;
let def_map = db.crate_def_map(krate);
let (_, name) = def_map.exported_proc_macros().find(|&(id, _)| id == self.id)?;
Some(name)
}
}
}