Update references to macro_rules in the "Extract module" assist

See https://github.com/rust-analyzer/ungrammar/pull/46#issuecomment-1049801890.
This commit is contained in:
Chayim Refael Friedman 2022-02-25 01:23:40 +00:00 committed by GitHub
parent 3149e69247
commit 73708d4405

View File

@ -240,6 +240,11 @@ impl Module {
self.expand_and_group_usages_file_wise(ctx, node_def, &mut refs);
}
},
ast::Macro(it) => {
if let Some(nod) = ctx.sema.to_def(&it) {
self.expand_and_group_usages_file_wise(ctx, Definition::Macro(nod), &mut refs);
}
},
_ => (),
}
}
@ -1375,6 +1380,27 @@ mod modname {
)
}
#[test]
fn test_extract_module_macro_rules() {
check_assist(
extract_module,
r"
$0macro_rules! m {
() => {};
}$0
m! {}
",
r"
mod modname {
macro_rules! m {
() => {};
}
}
modname::m! {}
",
);
}
#[test]
fn test_do_not_apply_visibility_modifier_to_trait_impl_items() {
check_assist(