From 46084f8a96dc94cad06c269d93269e7c5f7e4fad Mon Sep 17 00:00:00 2001 From: vsrs Date: Sat, 6 Jun 2020 20:10:36 +0300 Subject: Disable runnables lookup in macro-generated code. --- crates/ra_ide/src/hover.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'crates') diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 138a7a7a9..bbff5e81a 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -200,7 +200,16 @@ fn runnable_action( _ => None, }, ModuleDef::Function(it) => { - runnable(&sema, it.source(sema.db).value.syntax().clone(), file_id) + let src = it.source(sema.db); + if src.file_id != file_id.into() { + // Don't try to find runnables in a macro generated code. + // See tests below: + // test_hover_macro_generated_struct_fn_doc_comment + // test_hover_macro_generated_struct_fn_doc_attr + return None; + } + + runnable(&sema, src.value.syntax().clone(), file_id) .map(|it| HoverAction::Runnable(it)) } _ => None, -- cgit v1.2.3