mirror of
https://github.com/denoland/deno.git
synced 2025-10-03 07:34:36 +00:00
fix(repl): highlight from ident in import from or export from (#20023)
This commit is contained in:
parent
029bdf0cd5
commit
e8d03119a0
1 changed files with 9 additions and 0 deletions
|
@ -389,6 +389,15 @@ impl Highlighter for EditorHelper {
|
||||||
// We're looking for something that looks like a function
|
// We're looking for something that looks like a function
|
||||||
// We use a simple heuristic: 'ident' followed by 'LParen'
|
// We use a simple heuristic: 'ident' followed by 'LParen'
|
||||||
colors::intense_blue(&line[range]).to_string()
|
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 {
|
} else {
|
||||||
line[range].to_string()
|
line[range].to_string()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue