languages: Separate control flow keywords for JS/TS/TSX (#39801)
Related to #9461, inspired by #39683 `await` and `yield` both seem somewhat debatable on whether they should be considered the be control flow keywords. For now I went with: - `await`: no – The control flow effect of `await` is at a level does not seem relevant for syntax highlighting. - `yield`: yes – `yield` directly affects the output of a generator, and is also included for consistency with Rust (#39683). Happy to change these either direction. <img width="1151" height="730" alt="SCR-20251008-izus" src="https://github.com/user-attachments/assets/533ea670-863a-4c5c-aaa5-4a9bfa0bf0dd" /> --- Release Notes: - Improved granularity of keyword highlighting for JS/TS/TSX: Themes can now specify `keyword.control` for control flow keywords like `if`, `else`, `return`, etc.
This commit is contained in:
@@ -171,47 +171,52 @@
|
||||
"as"
|
||||
"async"
|
||||
"await"
|
||||
"break"
|
||||
"case"
|
||||
"catch"
|
||||
"class"
|
||||
"const"
|
||||
"continue"
|
||||
"debugger"
|
||||
"default"
|
||||
"delete"
|
||||
"do"
|
||||
"else"
|
||||
"export"
|
||||
"extends"
|
||||
"finally"
|
||||
"for"
|
||||
"from"
|
||||
"function"
|
||||
"get"
|
||||
"if"
|
||||
"import"
|
||||
"in"
|
||||
"instanceof"
|
||||
"let"
|
||||
"new"
|
||||
"of"
|
||||
"return"
|
||||
"set"
|
||||
"static"
|
||||
"switch"
|
||||
"target"
|
||||
"throw"
|
||||
"try"
|
||||
"typeof"
|
||||
"using"
|
||||
"var"
|
||||
"void"
|
||||
"while"
|
||||
"with"
|
||||
"yield"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"break"
|
||||
"case"
|
||||
"catch"
|
||||
"continue"
|
||||
"do"
|
||||
"else"
|
||||
"finally"
|
||||
"for"
|
||||
"if"
|
||||
"return"
|
||||
"switch"
|
||||
"throw"
|
||||
"try"
|
||||
"while"
|
||||
"yield"
|
||||
] @keyword.control
|
||||
|
||||
(switch_default "default" @keyword.control)
|
||||
|
||||
(template_substitution
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special) @embedded
|
||||
|
||||
@@ -171,25 +171,16 @@
|
||||
"as"
|
||||
"async"
|
||||
"await"
|
||||
"break"
|
||||
"case"
|
||||
"catch"
|
||||
"class"
|
||||
"const"
|
||||
"continue"
|
||||
"debugger"
|
||||
"default"
|
||||
"delete"
|
||||
"do"
|
||||
"else"
|
||||
"export"
|
||||
"extends"
|
||||
"finally"
|
||||
"for"
|
||||
"from"
|
||||
"function"
|
||||
"get"
|
||||
"if"
|
||||
"import"
|
||||
"in"
|
||||
"instanceof"
|
||||
@@ -197,23 +188,37 @@
|
||||
"let"
|
||||
"new"
|
||||
"of"
|
||||
"return"
|
||||
"satisfies"
|
||||
"set"
|
||||
"static"
|
||||
"switch"
|
||||
"target"
|
||||
"throw"
|
||||
"try"
|
||||
"typeof"
|
||||
"using"
|
||||
"var"
|
||||
"void"
|
||||
"while"
|
||||
"with"
|
||||
"yield"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"break"
|
||||
"case"
|
||||
"catch"
|
||||
"continue"
|
||||
"do"
|
||||
"else"
|
||||
"finally"
|
||||
"for"
|
||||
"if"
|
||||
"return"
|
||||
"switch"
|
||||
"throw"
|
||||
"try"
|
||||
"while"
|
||||
"yield"
|
||||
] @keyword.control
|
||||
|
||||
(switch_default "default" @keyword.control)
|
||||
|
||||
(template_substitution
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special) @embedded
|
||||
|
||||
@@ -218,27 +218,18 @@
|
||||
"as"
|
||||
"async"
|
||||
"await"
|
||||
"break"
|
||||
"case"
|
||||
"catch"
|
||||
"class"
|
||||
"const"
|
||||
"continue"
|
||||
"debugger"
|
||||
"declare"
|
||||
"default"
|
||||
"delete"
|
||||
"do"
|
||||
"else"
|
||||
"enum"
|
||||
"export"
|
||||
"extends"
|
||||
"finally"
|
||||
"for"
|
||||
"from"
|
||||
"function"
|
||||
"get"
|
||||
"if"
|
||||
"implements"
|
||||
"import"
|
||||
"in"
|
||||
@@ -257,20 +248,34 @@
|
||||
"protected"
|
||||
"public"
|
||||
"readonly"
|
||||
"return"
|
||||
"satisfies"
|
||||
"set"
|
||||
"static"
|
||||
"switch"
|
||||
"target"
|
||||
"throw"
|
||||
"try"
|
||||
"type"
|
||||
"typeof"
|
||||
"using"
|
||||
"var"
|
||||
"void"
|
||||
"while"
|
||||
"with"
|
||||
"yield"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"break"
|
||||
"case"
|
||||
"catch"
|
||||
"continue"
|
||||
"do"
|
||||
"else"
|
||||
"finally"
|
||||
"for"
|
||||
"if"
|
||||
"return"
|
||||
"switch"
|
||||
"throw"
|
||||
"try"
|
||||
"while"
|
||||
"yield"
|
||||
] @keyword.control
|
||||
|
||||
(switch_default "default" @keyword.control)
|
||||
|
||||
Reference in New Issue
Block a user