mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 00:13:21 +01:00
Fix list spread syntax highlighting (#12793)
# Description I broke syntax highlighting for list spreads in #12529. This should fix #12792 😅. I just copied the code for highlighting record spreads.
This commit is contained in:
parent
eccc558a4e
commit
c54d223ea0
@ -385,12 +385,23 @@ fn flatten_expression_into(
|
||||
|
||||
output.extend(flattened);
|
||||
}
|
||||
ListItem::Spread(_, expr) => {
|
||||
output.push((
|
||||
Span::new(expr.span.start, expr.span.start + 3),
|
||||
FlatShape::Operator,
|
||||
));
|
||||
flatten_expression_into(working_set, expr, output);
|
||||
ListItem::Spread(op_span, expr) => {
|
||||
if op_span.start > last_end {
|
||||
output.push((Span::new(last_end, op_span.start), FlatShape::List));
|
||||
}
|
||||
output.push((*op_span, FlatShape::Operator));
|
||||
last_end = op_span.end;
|
||||
|
||||
let flattened_inner = flatten_expression(working_set, expr);
|
||||
if let Some(first) = flattened_inner.first() {
|
||||
if first.0.start > last_end {
|
||||
output.push((Span::new(last_end, first.0.start), FlatShape::List));
|
||||
}
|
||||
}
|
||||
if let Some(last) = flattened_inner.last() {
|
||||
last_end = last.0.end;
|
||||
}
|
||||
output.extend(flattened_inner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3895,7 +3895,7 @@ pub fn parse_list_expression(
|
||||
Type::List(elem_ty) => *elem_ty.clone(),
|
||||
_ => Type::Any,
|
||||
};
|
||||
let span = Span::new(curr_span.start, spread_arg.span.end);
|
||||
let span = Span::new(curr_span.start, curr_span.start + 3);
|
||||
(ListItem::Spread(span, spread_arg), elem_ty)
|
||||
} else {
|
||||
let arg = parse_multispan_value(
|
||||
|
Loading…
Reference in New Issue
Block a user