Include line number when debug printing lists

pull/226/head
Wilfred Hughes 2022-05-05 20:38:29 +07:00
parent 59cea9f00a
commit a8d064eacf
1 changed files with 10 additions and 2 deletions

@ -285,9 +285,17 @@ impl<'a> Syntax<'a> {
match self {
List {
open_content,
open_position,
close_content,
..
} => format!("{} ... {}", open_content, close_content),
} => {
let line = open_position
.first()
.map(|p| format!("{}", p.line.one_indexed()))
.unwrap_or_else(|| "?".to_owned());
format!("line:{} {} ... {}", line, open_content, close_content)
}
Atom {
content, position, ..
} => {
@ -296,7 +304,7 @@ impl<'a> Syntax<'a> {
.map(|p| format!("{}", p.line.one_indexed()))
.unwrap_or_else(|| "?".to_owned());
format!("{} line:{}", content, line)
format!("line:{} {}", line, content)
}
}
}