mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Use original_file_range
in TestDB
This commit is contained in:
parent
4943ef085d
commit
306c6cbaac
1 changed files with 3 additions and 9 deletions
|
@ -158,17 +158,11 @@ impl TestDB {
|
||||||
let src = d.display_source();
|
let src = d.display_source();
|
||||||
let root = db.parse_or_expand(src.file_id).unwrap();
|
let root = db.parse_or_expand(src.file_id).unwrap();
|
||||||
|
|
||||||
// Place all diagnostics emitted in macro files on the original caller.
|
let node = src.map(|ptr| ptr.to_node(&root));
|
||||||
// Note that this does *not* match IDE behavior.
|
let frange = node.as_ref().original_file_range(db);
|
||||||
let mut src = src.map(|ptr| ptr.to_node(&root));
|
|
||||||
while let Some(exp) = src.file_id.call_node(db) {
|
|
||||||
src = exp;
|
|
||||||
}
|
|
||||||
|
|
||||||
let file_id = src.file_id.original_file(db);
|
|
||||||
let range = src.value.text_range();
|
|
||||||
let message = d.message().to_owned();
|
let message = d.message().to_owned();
|
||||||
actual.entry(file_id).or_default().push((range, message));
|
actual.entry(frange.file_id).or_default().push((frange.range, message));
|
||||||
});
|
});
|
||||||
|
|
||||||
for (file_id, diags) in actual.iter_mut() {
|
for (file_id, diags) in actual.iter_mut() {
|
||||||
|
|
Loading…
Reference in a new issue