From e8d03119a0599ef8d811f8fa33ad1a580adf5511 Mon Sep 17 00:00:00 2001 From: await-ovo <13152410380@163.com> Date: Thu, 3 Aug 2023 04:27:03 +0800 Subject: [PATCH] fix(repl): highlight from ident in import from or export from (#20023) --- cli/tools/repl/editor.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cli/tools/repl/editor.rs b/cli/tools/repl/editor.rs index a27671b217..5c2832aab3 100644 --- a/cli/tools/repl/editor.rs +++ b/cli/tools/repl/editor.rs @@ -389,6 +389,15 @@ impl Highlighter for EditorHelper { // We're looking for something that looks like a function // We use a simple heuristic: 'ident' followed by 'LParen' colors::intense_blue(&line[range]).to_string() + } else if ident == *"from" + && matches!( + next, + Some(deno_ast::TokenOrComment::Token(Token::Str { .. })) + ) + { + // When ident 'from' is followed by a string literal, highlight it + // E.g. "export * from 'something'" or "import a from 'something'" + colors::cyan(&line[range]).to_string() } else { line[range].to_string() }