Skip to content

Commit 46084f8

Browse files
committed
Disable runnables lookup in macro-generated code.
1 parent 3434f1d commit 46084f8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

crates/ra_ide/src/hover.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,16 @@ fn runnable_action(
200200
_ => None,
201201
},
202202
ModuleDef::Function(it) => {
203-
runnable(&sema, it.source(sema.db).value.syntax().clone(), file_id)
203+
let src = it.source(sema.db);
204+
if src.file_id != file_id.into() {
205+
// Don't try to find runnables in a macro generated code.
206+
// See tests below:
207+
// test_hover_macro_generated_struct_fn_doc_comment
208+
// test_hover_macro_generated_struct_fn_doc_attr
209+
return None;
210+
}
211+
212+
runnable(&sema, src.value.syntax().clone(), file_id)
204213
.map(|it| HoverAction::Runnable(it))
205214
}
206215
_ => None,

0 commit comments

Comments
 (0)