forked from extern/nushell
Fix syntax highlighting for new import patterns
This commit is contained in:
parent
bd6c550470
commit
78256b4923
@ -492,9 +492,15 @@ pub fn parse_use(
|
|||||||
let bytes = working_set.get_span_contents(spans[0]);
|
let bytes = working_set.get_span_contents(spans[0]);
|
||||||
|
|
||||||
if bytes == b"use" && spans.len() >= 2 {
|
if bytes == b"use" && spans.len() >= 2 {
|
||||||
let (module_name_expr, err) = parse_string(working_set, spans[1]);
|
let mut import_pattern_exprs: Vec<Expression> = vec![];
|
||||||
error = error.or(err);
|
for span in spans[1..].iter() {
|
||||||
|
let (expr, err) = parse_string(working_set, *span);
|
||||||
|
import_pattern_exprs.push(expr);
|
||||||
|
error = error.or(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Add checking for importing too long import patterns, e.g.:
|
||||||
|
// > use spam foo non existent names here do not throw error
|
||||||
let (import_pattern, err) = parse_import_pattern(working_set, &spans[1..]);
|
let (import_pattern, err) = parse_import_pattern(working_set, &spans[1..]);
|
||||||
error = error.or(err);
|
error = error.or(err);
|
||||||
|
|
||||||
@ -598,7 +604,7 @@ pub fn parse_use(
|
|||||||
let call = Box::new(Call {
|
let call = Box::new(Call {
|
||||||
head: spans[0],
|
head: spans[0],
|
||||||
decl_id: use_decl_id,
|
decl_id: use_decl_id,
|
||||||
positional: vec![module_name_expr],
|
positional: import_pattern_exprs,
|
||||||
named: vec![],
|
named: vec![],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user