diff --git a/crates/nu-cli/tests/commands/nu_highlight.rs b/crates/nu-cli/tests/commands/nu_highlight.rs index bd185a8634..c7d2e07c80 100644 --- a/crates/nu-cli/tests/commands/nu_highlight.rs +++ b/crates/nu-cli/tests/commands/nu_highlight.rs @@ -5,3 +5,9 @@ fn nu_highlight_not_expr() { let actual = nu!("'not false' | nu-highlight | ansi strip"); assert_eq!(actual.out, "not false"); } + +#[test] +fn nu_highlight_where_row_condition() { + let actual = nu!("'ls | where a b 12345(' | nu-highlight | ansi strip"); + assert_eq!(actual.out, "ls | where a b 12345("); +} diff --git a/crates/nu-command/src/filters/where_.rs b/crates/nu-command/src/filters/where_.rs index b77dd13a9a..467b8530ae 100644 --- a/crates/nu-command/src/filters/where_.rs +++ b/crates/nu-command/src/filters/where_.rs @@ -43,10 +43,7 @@ Row conditions cannot be stored in a variable. To pass a condition with a variab ]) .required( "condition", - SyntaxShape::OneOf(vec![ - SyntaxShape::RowCondition, - SyntaxShape::Closure(Some(vec![SyntaxShape::Any])), - ]), + SyntaxShape::RowCondition, "Filter row condition or closure.", ) .allow_variants_without_examples(true) diff --git a/crates/nu-protocol/src/syntax_shape.rs b/crates/nu-protocol/src/syntax_shape.rs index 44dd4903d3..7f1e2f95b6 100644 --- a/crates/nu-protocol/src/syntax_shape.rs +++ b/crates/nu-protocol/src/syntax_shape.rs @@ -239,7 +239,11 @@ impl Display for SyntaxShape { SyntaxShape::Duration => write!(f, "duration"), SyntaxShape::DateTime => write!(f, "datetime"), SyntaxShape::Operator => write!(f, "operator"), - SyntaxShape::RowCondition => write!(f, "condition"), + SyntaxShape::RowCondition => write!( + f, + "oneof", + SyntaxShape::Closure(Some(vec![SyntaxShape::Any])) + ), SyntaxShape::MathExpression => write!(f, "variable"), SyntaxShape::VarWithOptType => write!(f, "vardecl"), SyntaxShape::Signature => write!(f, "signature"),