completion now prefers completing variable names before trying comp specs
improved color picking for error messages
This commit is contained in:
@@ -315,6 +315,7 @@ impl Dispatcher {
|
||||
Ok(())
|
||||
}
|
||||
fn exec_subsh(&mut self, subsh: Node) -> ShResult<()> {
|
||||
let blame = subsh.get_span().clone();
|
||||
let NdRule::Command { assignments, argv } = subsh.class else {
|
||||
unreachable!()
|
||||
};
|
||||
@@ -328,7 +329,7 @@ impl Dispatcher {
|
||||
let mut argv = match prepare_argv(argv) {
|
||||
Ok(argv) => argv,
|
||||
Err(e) => {
|
||||
e.print_error();
|
||||
e.try_blame(blame).print_error();
|
||||
return;
|
||||
}
|
||||
};
|
||||
@@ -376,7 +377,7 @@ impl Dispatcher {
|
||||
|
||||
blame.rename(func_name.clone());
|
||||
|
||||
let argv = prepare_argv(argv)?;
|
||||
let argv = prepare_argv(argv).try_blame(blame.clone())?;
|
||||
let result = if let Some(ref mut func_body) = read_logic(|l| l.get_func(&func_name)) {
|
||||
let _guard = ScopeGuard::exclusive_scope(Some(argv));
|
||||
func_body.body_mut().propagate_context(func_ctx);
|
||||
@@ -833,6 +834,7 @@ impl Dispatcher {
|
||||
}
|
||||
}
|
||||
fn exec_cmd(&mut self, cmd: Node) -> ShResult<()> {
|
||||
let blame = cmd.get_span().clone();
|
||||
let context = cmd.context.clone();
|
||||
let NdRule::Command { assignments, argv } = cmd.class else {
|
||||
unreachable!()
|
||||
@@ -856,7 +858,7 @@ impl Dispatcher {
|
||||
|
||||
self.io_stack.append_to_frame(cmd.redirs);
|
||||
|
||||
let exec_args = ExecArgs::new(argv)?;
|
||||
let exec_args = ExecArgs::new(argv).blame(blame)?;
|
||||
let _guard = self.io_stack.pop_frame().redirect()?;
|
||||
let job = self.job_stack.curr_job_mut().unwrap();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use lex::{LexFlags, LexStream, Span, SpanSource, Tk, TkFlags, TkRule};
|
||||
|
||||
use crate::{
|
||||
libsh::{
|
||||
error::{ShErr, ShErrKind, ShResult, next_color},
|
||||
error::{ShErr, ShErrKind, ShResult, last_color, next_color},
|
||||
utils::{NodeVecUtils, TkVecUtils},
|
||||
},
|
||||
prelude::*,
|
||||
@@ -135,7 +135,7 @@ impl Node {
|
||||
}
|
||||
}
|
||||
pub fn get_context(&self, msg: String) -> (SpanSource, Label<Span>) {
|
||||
let color = next_color();
|
||||
let color = last_color();
|
||||
let span = self.get_span().clone();
|
||||
(
|
||||
span.clone().source().clone(),
|
||||
@@ -1745,7 +1745,7 @@ pub fn get_redir_file(class: RedirType, path: PathBuf) -> ShResult<File> {
|
||||
}
|
||||
|
||||
fn parse_err_full(reason: &str, blame: &Span, context: LabelCtx) -> ShErr {
|
||||
let color = next_color();
|
||||
let color = last_color();
|
||||
ShErr::new(ShErrKind::ParseErr, blame.clone())
|
||||
.with_label(
|
||||
blame.span_source().clone(),
|
||||
|
||||
Reference in New Issue
Block a user