mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Render matched macro arm on hover of macro calls
This commit is contained in:
parent
062e1b9b81
commit
6bfdd38c69
11 changed files with 133 additions and 65 deletions
|
@ -403,6 +403,7 @@ pub(super) fn definition(
|
|||
def: Definition,
|
||||
famous_defs: Option<&FamousDefs<'_, '_>>,
|
||||
notable_traits: &[(Trait, Vec<(Option<Type>, Name)>)],
|
||||
macro_arm: Option<u32>,
|
||||
config: &HoverConfig,
|
||||
) -> Markup {
|
||||
let mod_path = definition_mod_path(db, &def);
|
||||
|
@ -413,6 +414,13 @@ pub(super) fn definition(
|
|||
Definition::Adt(Adt::Struct(struct_)) => {
|
||||
struct_.display_limited(db, config.max_struct_field_count).to_string()
|
||||
}
|
||||
Definition::Macro(it) => {
|
||||
let mut label = it.display(db).to_string();
|
||||
if let Some(macro_arm) = macro_arm {
|
||||
format_to!(label, " // matched arm #{}", macro_arm);
|
||||
}
|
||||
label
|
||||
}
|
||||
_ => def.label(db),
|
||||
};
|
||||
let docs = def.docs(db, famous_defs);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue