diff --git a/crates/nu-cli/src/syntax_highlight.rs b/crates/nu-cli/src/syntax_highlight.rs index 3471b0412..54804b76f 100644 --- a/crates/nu-cli/src/syntax_highlight.rs +++ b/crates/nu-cli/src/syntax_highlight.rs @@ -40,6 +40,7 @@ impl Highlighter for NuHighlighter { .to_string(); match shape.1 { FlatShape::External => output.push((Style::new().bold(), next_token)), + FlatShape::ExternalArg => output.push((Style::new().bold(), next_token)), FlatShape::Garbage => output.push(( Style::new() .fg(nu_ansi_term::Color::White) diff --git a/crates/nu-parser/src/flatten.rs b/crates/nu-parser/src/flatten.rs index 1f9279454..17bc3178c 100644 --- a/crates/nu-parser/src/flatten.rs +++ b/crates/nu-parser/src/flatten.rs @@ -10,6 +10,7 @@ pub enum FlatShape { Range, InternalCall, External, + ExternalArg, Literal, Operator, Signature, @@ -55,8 +56,14 @@ pub fn flatten_expression( } output } - Expr::ExternalCall(..) => { - vec![(expr.span, FlatShape::External)] + Expr::ExternalCall(name, args) => { + let mut output = vec![(*name, FlatShape::External)]; + + for arg in args { + output.push((*arg, FlatShape::ExternalArg)); + } + + output } Expr::Garbage => { vec![(expr.span, FlatShape::Garbage)] diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index 0bea2fe27..cb68e00ec 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -60,14 +60,14 @@ fn check_call(command: Span, sig: &Signature, call: &Call) -> Option } pub fn parse_external_call( - working_set: &mut StateWorkingSet, + _working_set: &mut StateWorkingSet, spans: &[Span], ) -> (Expression, Option) { // TODO: add external parsing let mut args = vec![]; - let name = working_set.get_span_contents(spans[0]).to_vec(); + let name = spans[0]; for span in &spans[1..] { - args.push(working_set.get_span_contents(*span).to_vec()); + args.push(*span); } ( Expression { diff --git a/crates/nu-protocol/src/ast/expr.rs b/crates/nu-protocol/src/ast/expr.rs index 5a873631e..f26673f2a 100644 --- a/crates/nu-protocol/src/ast/expr.rs +++ b/crates/nu-protocol/src/ast/expr.rs @@ -13,7 +13,7 @@ pub enum Expr { ), Var(VarId), Call(Box), - ExternalCall(Vec, Vec>), + ExternalCall(Span, Vec), Operator(Operator), RowCondition(VarId, Box), BinaryOp(Box, Box, Box), //lhs, op, rhs diff --git a/crates/nu-table/src/table.rs b/crates/nu-table/src/table.rs index 817c59ef9..3110e2751 100644 --- a/crates/nu-table/src/table.rs +++ b/crates/nu-table/src/table.rs @@ -685,6 +685,7 @@ impl WrappedTable { ); } } + output.push('\n'); } SeparatorPosition::Middle => { for column in self.column_widths.iter().enumerate() { @@ -728,6 +729,7 @@ impl WrappedTable { .push_str(&sep_color.paint(&self.theme.center.to_string()).to_string()); } } + output.push('\n'); } SeparatorPosition::Bottom => { for column in self.column_widths.iter().enumerate() { @@ -774,7 +776,6 @@ impl WrappedTable { } } } - output.push('\n'); output }