aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-06-01 12:34:19 +0100
committerEdwin Cheng <[email protected]>2019-06-01 12:34:19 +0100
commit371961be0e0b0741599ebf3d9435c03fd45cf777 (patch)
tree21ffd6c02196fc8419abf15f1206b9608378b234 /crates/ra_ide_api
parent6c1ec865fb931ffd789e2caa9e2ce82d1df97c4d (diff)
Improve goto definition for MBE
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/goto_definition.rs23
-rw-r--r--crates/ra_ide_api/src/name_ref_kind.rs2
2 files changed, 24 insertions, 1 deletions
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs
index 97b367115..e72b7a6e7 100644
--- a/crates/ra_ide_api/src/goto_definition.rs
+++ b/crates/ra_ide_api/src/goto_definition.rs
@@ -217,6 +217,29 @@ mod tests {
217 } 217 }
218 218
219 #[test] 219 #[test]
220 fn goto_definition_works_for_macros_from_other_crates() {
221 covers!(goto_definition_works_for_macros);
222 check_goto(
223 "
224 //- /lib.rs
225 use foo::foo;
226 fn bar() {
227 <|>foo!();
228 }
229
230 //- /foo/lib.rs
231 #[macro_export]
232 macro_rules! foo {
233 () => {
234 {}
235 };
236 }
237 ",
238 "foo MACRO_CALL FileId(2) [0; 79) [29; 32)",
239 );
240 }
241
242 #[test]
220 fn goto_definition_works_for_methods() { 243 fn goto_definition_works_for_methods() {
221 covers!(goto_definition_works_for_methods); 244 covers!(goto_definition_works_for_methods);
222 check_goto( 245 check_goto(
diff --git a/crates/ra_ide_api/src/name_ref_kind.rs b/crates/ra_ide_api/src/name_ref_kind.rs
index b498fe495..90972bc58 100644
--- a/crates/ra_ide_api/src/name_ref_kind.rs
+++ b/crates/ra_ide_api/src/name_ref_kind.rs
@@ -39,7 +39,7 @@ pub(crate) fn classify_name_ref(
39 .and_then(ast::MacroCall::cast) 39 .and_then(ast::MacroCall::cast)
40 { 40 {
41 tested_by!(goto_definition_works_for_macros); 41 tested_by!(goto_definition_works_for_macros);
42 if let Some(mac) = analyzer.resolve_macro_call(macro_call) { 42 if let Some(mac) = analyzer.resolve_macro_call(db, macro_call) {
43 return Some(Macro(mac)); 43 return Some(Macro(mac));
44 } 44 }
45 } 45 }