aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvsrs <[email protected]>2020-06-06 18:10:36 +0100
committervsrs <[email protected]>2020-06-06 18:10:36 +0100
commit46084f8a96dc94cad06c269d93269e7c5f7e4fad (patch)
tree41a8b3b9518b6afcd4c27697a52088f956099804
parent3434f1dd2c47fff3df159b9d62115c2df3fd6401 (diff)
Disable runnables lookup in macro-generated code.
-rw-r--r--crates/ra_ide/src/hover.rs11
1 files changed, 10 insertions, 1 deletions
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(
200 _ => None, 200 _ => None,
201 }, 201 },
202 ModuleDef::Function(it) => { 202 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)
204 .map(|it| HoverAction::Runnable(it)) 213 .map(|it| HoverAction::Runnable(it))
205 } 214 }
206 _ => None, 215 _ => None,