mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-26 11:55:04 +00:00
Fix logic for determining macro calls
I believe this currently goes back all the way to the initial user-written call, but that seems better than the current broken behavior.
This commit is contained in:
parent
306c6cbaac
commit
da5027138d
1 changed files with 7 additions and 9 deletions
|
@ -457,17 +457,15 @@ impl<'a> InFile<&'a SyntaxNode> {
|
||||||
return FileRange { file_id: range.file_id.original_file(db), range: range.value };
|
return FileRange { file_id: range.file_id.original_file(db), range: range.value };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fall back to whole macro call
|
// Fall back to whole macro call.
|
||||||
if let Some(expansion) = self.file_id.expansion_info(db) {
|
let mut node = self.cloned();
|
||||||
if let Some(call_node) = expansion.call_node() {
|
while let Some(call_node) = node.file_id.call_node(db) {
|
||||||
return FileRange {
|
node = call_node;
|
||||||
file_id: call_node.file_id.original_file(db),
|
|
||||||
range: call_node.value.text_range(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FileRange { file_id: self.file_id.original_file(db), range: self.value.text_range() }
|
let orig_file = node.file_id.original_file(db);
|
||||||
|
assert_eq!(node.file_id, orig_file.into());
|
||||||
|
FileRange { file_id: orig_file, range: node.value.text_range() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue