Store an AstId for procedural macros

This commit is contained in:
Jonas Schievink 2021-03-18 16:11:18 +01:00
parent 3ab9b39dd4
commit c05a1a6e37
11 changed files with 47 additions and 26 deletions

View file

@ -331,10 +331,16 @@ fn hover_for_definition(
) -> Option<Markup> {
let mod_path = definition_mod_path(db, &def);
return match def {
Definition::Macro(it) => {
let label = macro_label(&it.source(db)?.value);
from_def_source_labeled(db, it, Some(label), mod_path)
}
Definition::Macro(it) => match &it.source(db)?.value {
Either::Left(mac) => {
let label = macro_label(&mac);
from_def_source_labeled(db, it, Some(label), mod_path)
}
Either::Right(_) => {
// FIXME
None
}
},
Definition::Field(def) => from_hir_fmt(db, def, mod_path),
Definition::ModuleDef(it) => match it {
ModuleDef::Module(it) => from_hir_fmt(db, it, mod_path),