Add parser tracing, fix 629 (#638)

This commit is contained in:
JT
2022-01-02 08:42:50 +11:00
committed by GitHub
parent 4383b372f5
commit ac487dfcbc
9 changed files with 208 additions and 4 deletions

View File

@ -15,3 +15,4 @@ nu-color-config = { path = "../nu-color-config" }
miette = { version = "3.0.0", features = ["fancy"] }
thiserror = "1.0.29"
reedline = { git = "https://github.com/nushell/reedline", branch = "main" }
log = "0.4"

View File

@ -1,3 +1,4 @@
use log::trace;
use nu_ansi_term::Style;
use nu_color_config::get_shape_color;
use nu_parser::{flatten_block, parse, FlatShape};
@ -12,6 +13,8 @@ pub struct NuHighlighter {
impl Highlighter for NuHighlighter {
fn highlight(&self, line: &str) -> StyledText {
trace!("highlighting: {}", line);
let (shapes, global_span_offset) = {
let mut working_set = StateWorkingSet::new(&self.engine_state);
let (block, _) = parse(&mut working_set, None, line.as_bytes(), false);