From 78256b49231d9bb5b6b6f4c99b7042b1ea49da4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=BD=C3=A1dn=C3=ADk?= Date: Wed, 27 Oct 2021 00:30:39 +0300 Subject: [PATCH] Fix syntax highlighting for new import patterns --- crates/nu-parser/src/parse_keywords.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/nu-parser/src/parse_keywords.rs b/crates/nu-parser/src/parse_keywords.rs index c5de2f8918..be6366bc72 100644 --- a/crates/nu-parser/src/parse_keywords.rs +++ b/crates/nu-parser/src/parse_keywords.rs @@ -492,9 +492,15 @@ pub fn parse_use( let bytes = working_set.get_span_contents(spans[0]); if bytes == b"use" && spans.len() >= 2 { - let (module_name_expr, err) = parse_string(working_set, spans[1]); - error = error.or(err); + let mut import_pattern_exprs: Vec = vec![]; + 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..]); error = error.or(err); @@ -598,7 +604,7 @@ pub fn parse_use( let call = Box::new(Call { head: spans[0], decl_id: use_decl_id, - positional: vec![module_name_expr], + positional: import_pattern_exprs, named: vec![], });