Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/extract_module.rs')
-rw-r--r--crates/ide-assists/src/handlers/extract_module.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/ide-assists/src/handlers/extract_module.rs b/crates/ide-assists/src/handlers/extract_module.rs
index 9e06a17337..40eaed0080 100644
--- a/crates/ide-assists/src/handlers/extract_module.rs
+++ b/crates/ide-assists/src/handlers/extract_module.rs
@@ -733,6 +733,7 @@ fn check_def_in_mod_and_out_sel(
Definition::Static(x) => check_item!(x),
Definition::Trait(x) => check_item!(x),
Definition::TypeAlias(x) => check_item!(x),
+ Definition::Macro(x) => check_item!(x),
_ => {}
}
@@ -1813,4 +1814,33 @@ mod foo {
"#,
)
}
+
+ #[test]
+ fn test_extract_module_macro_call_import() {
+ check_assist(
+ extract_module,
+ r"
+macro_rules! my_macro {
+ () => {};
+}
+
+$0fn bar() {
+ my_macro!();
+}$0
+ ",
+ r"
+macro_rules! my_macro {
+ () => {};
+}
+
+mod modname {
+ use super::my_macro;
+
+ pub(crate) fn bar() {
+ my_macro!();
+ }
+}
+ ",
+ )
+ }
}