diff --git a/crates/nu-cli/src/syntax_highlight.rs b/crates/nu-cli/src/syntax_highlight.rs index 3471b04128..54804b76f5 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 1f92794546..17bc3178c9 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 9fba1a2d87..fcfbe7e34f 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -80,14 +80,14 @@ fn check_name(working_set: &mut StateWorkingSet, spans: &[Span]) -> Option (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 5a873631e8..f26673f2a1 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 817c59ef99..3110e2751d 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 }