mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
hide root
This commit is contained in:
parent
ed7ae78c6f
commit
70097504f7
10 changed files with 91 additions and 65 deletions
|
@ -1,13 +1,13 @@
|
|||
use std::fmt::Write;
|
||||
use {
|
||||
algo::walk::{walk, WalkEvent},
|
||||
SyntaxNode,
|
||||
SyntaxNode, TreeRoot,
|
||||
};
|
||||
|
||||
/// Parse a file and create a string representation of the resulting parse tree.
|
||||
pub fn dump_tree(syntax: &SyntaxNode) -> String {
|
||||
let syntax = syntax.as_ref();
|
||||
let mut errors: Vec<_> = syntax.root.errors.iter().cloned().collect();
|
||||
let mut errors: Vec<_> = syntax.root.syntax_root().errors.iter().cloned().collect();
|
||||
errors.sort_by_key(|e| e.offset);
|
||||
let mut err_pos = 0;
|
||||
let mut level = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue