mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Improve goto definition for MBE
This commit is contained in:
parent
6c1ec865fb
commit
371961be0e
6 changed files with 55 additions and 9 deletions
|
@ -216,6 +216,29 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn goto_definition_works_for_macros_from_other_crates() {
|
||||
covers!(goto_definition_works_for_macros);
|
||||
check_goto(
|
||||
"
|
||||
//- /lib.rs
|
||||
use foo::foo;
|
||||
fn bar() {
|
||||
<|>foo!();
|
||||
}
|
||||
|
||||
//- /foo/lib.rs
|
||||
#[macro_export]
|
||||
macro_rules! foo {
|
||||
() => {
|
||||
{}
|
||||
};
|
||||
}
|
||||
",
|
||||
"foo MACRO_CALL FileId(2) [0; 79) [29; 32)",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn goto_definition_works_for_methods() {
|
||||
covers!(goto_definition_works_for_methods);
|
||||
|
|
|
@ -39,7 +39,7 @@ pub(crate) fn classify_name_ref(
|
|||
.and_then(ast::MacroCall::cast)
|
||||
{
|
||||
tested_by!(goto_definition_works_for_macros);
|
||||
if let Some(mac) = analyzer.resolve_macro_call(macro_call) {
|
||||
if let Some(mac) = analyzer.resolve_macro_call(db, macro_call) {
|
||||
return Some(Macro(mac));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue