mirror of
https://github.com/nushell/nushell.git
synced 2025-05-08 20:14:26 +02:00
Fix syntax highlighting for not
(#12815)
# Description Fixes #12813 where a panic occurs when syntax highlighting `not`. Also fixes #12814 where syntax highlighting for `not` no longer works. # User-Facing Changes Bug fix.
This commit is contained in:
parent
7271ad7909
commit
1b2e680059
1
crates/nu-cli/tests/commands/mod.rs
Normal file
1
crates/nu-cli/tests/commands/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
mod nu_highlight;
|
7
crates/nu-cli/tests/commands/nu_highlight.rs
Normal file
7
crates/nu-cli/tests/commands/nu_highlight.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
use nu_test_support::nu;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn nu_highlight_not_expr() {
|
||||||
|
let actual = nu!("'not false' | nu-highlight | ansi strip");
|
||||||
|
assert_eq!(actual.out, "not false");
|
||||||
|
}
|
2
crates/nu-cli/tests/main.rs
Normal file
2
crates/nu-cli/tests/main.rs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
mod commands;
|
||||||
|
mod completions;
|
@ -180,12 +180,12 @@ fn flatten_expression_into(
|
|||||||
flatten_expression_into(working_set, op, output);
|
flatten_expression_into(working_set, op, output);
|
||||||
flatten_expression_into(working_set, rhs, output);
|
flatten_expression_into(working_set, rhs, output);
|
||||||
}
|
}
|
||||||
Expr::UnaryNot(expr) => {
|
Expr::UnaryNot(not) => {
|
||||||
output.push((
|
output.push((
|
||||||
Span::new(expr.span.start, expr.span.start + 3),
|
Span::new(expr.span.start, expr.span.start + 3),
|
||||||
FlatShape::Operator,
|
FlatShape::Operator,
|
||||||
));
|
));
|
||||||
flatten_expression_into(working_set, expr, output);
|
flatten_expression_into(working_set, not, output);
|
||||||
}
|
}
|
||||||
Expr::Closure(block_id) => {
|
Expr::Closure(block_id) => {
|
||||||
let outer_span = expr.span;
|
let outer_span = expr.span;
|
||||||
|
Loading…
Reference in New Issue
Block a user