diff options
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 23 | ||||
-rw-r--r-- | crates/ra_ide_api/src/name_ref_kind.rs | 2 |
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 | } |