1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-21 21:50:00 -05:00

fix(repl): highlight from ident in import from or export from (#20023)

This commit is contained in:
await-ovo 2023-08-03 04:27:03 +08:00 committed by GitHub
parent 029bdf0cd5
commit e8d03119a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()
}