mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
internal: allow macro tests to inspect parse tree
This commit is contained in:
parent
aac23f7832
commit
c41b7bbe69
3 changed files with 53 additions and 42 deletions
|
@ -69,6 +69,13 @@ fn check(ra_fixture: &str, mut expect: Expect) {
|
|||
let indent = IndentLevel::from_node(call.syntax());
|
||||
let pp = reindent(indent, pp);
|
||||
format_to!(expn_text, "{}", pp);
|
||||
if call.to_string().contains("// +tree") {
|
||||
let tree = format!("{:#?}", parse.syntax_node())
|
||||
.split_inclusive("\n")
|
||||
.map(|line| format!("// {}", line))
|
||||
.collect::<String>();
|
||||
format_to!(expn_text, "\n{}", tree)
|
||||
}
|
||||
}
|
||||
let range = call.syntax().text_range();
|
||||
let range: Range<usize> = range.into();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue