mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 12:29:28 +00:00
Manual impl of Debug
on Token
(#11958)
## Summary I look at the token stream a lot, not specifically in the playground but in the terminal output and it's annoying to scroll a lot to find specific location. Most of the information is also redundant. The final format we end up with is: `<kind> <range> (flags = ...)` e.g., `String 0..4 (flags = BYTE_STRING)` where the flags part is only populated if there are any flags set.
This commit is contained in:
parent
b1e7bf76da
commit
81160320de
5 changed files with 23 additions and 11 deletions
|
@ -261,7 +261,7 @@ impl Workspace {
|
|||
pub fn tokens(&self, contents: &str) -> Result<String, Error> {
|
||||
let parsed = parse_unchecked(contents, Mode::Module);
|
||||
|
||||
Ok(format!("{:#?}", parsed.tokens()))
|
||||
Ok(format!("{:#?}", parsed.tokens().as_ref()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue