Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions crates/chisel/src/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,16 @@ impl ChiselDispatcher {
// Create new source with exact input appended and parse
let (new_source, do_execute) = source.clone_with_new_line(input.to_string())?;

// TODO: Cloning / parsing the session source twice on non-inspected inputs kinda sucks.
// Should change up how this works.
let (cf, res) = source.inspect(input).await?;
if let Some(res) = &res {
let _ = sh_println!("{res}");
}
if cf.is_break() {
debug!(%input, ?res, "inspect success");
return Ok(ControlFlow::Continue(()));
// Only inspect when the snippet is appended to run() and will be executed.
if do_execute {
let (cf, res) = source.inspect(input).await?;
if let Some(res) = &res {
let _ = sh_println!("{res}");
}
if cf.is_break() {
debug!(%input, ?res, "inspect success");
return Ok(ControlFlow::Continue(()));
}
}

if do_execute {
Expand Down
Loading