mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:26:23 -04:00
fix(cli): account for process versions > 5 in the parse command's pretty
debug output.
The initial implementation of `--debug pretty` assumed process version
was bounded by `MAX_VERSION_COUNT`. However, we also have to account for
`MAX_VERSION_COUNT_OVERFLOW` as well as `halted_version_count`.
(cherry picked from commit 5cac4316db)
This commit is contained in:
parent
ec120d06f2
commit
17e4bf92c0
|
|
@ -306,13 +306,13 @@ pub fn parse_file_at_path(
|
|||
}
|
||||
writeln!(&mut io::stderr(), "{message}").unwrap();
|
||||
} else {
|
||||
#[rustfmt::skip]
|
||||
let colors = &[
|
||||
AnsiColor::White,
|
||||
AnsiColor::Red,
|
||||
AnsiColor::Blue,
|
||||
AnsiColor::Green,
|
||||
AnsiColor::Cyan,
|
||||
AnsiColor::Yellow,
|
||||
AnsiColor::White, AnsiColor::Red, AnsiColor::Blue, AnsiColor::Green,
|
||||
AnsiColor::Cyan, AnsiColor::Yellow, AnsiColor::Magenta,
|
||||
AnsiColor::BrightWhite, AnsiColor::BrightRed, AnsiColor::BrightBlue,
|
||||
AnsiColor::BrightGreen, AnsiColor::BrightCyan, AnsiColor::BrightYellow,
|
||||
AnsiColor::BrightMagenta,
|
||||
];
|
||||
if message.starts_with("process version:") {
|
||||
let comma_idx = message.find(',').unwrap();
|
||||
|
|
@ -321,7 +321,7 @@ pub fn parse_file_at_path(
|
|||
.unwrap();
|
||||
}
|
||||
let color = if use_color {
|
||||
Some(colors[curr_version])
|
||||
Some(colors[curr_version % colors.len()])
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue