diff --git a/TypeScript.YAML-tmLanguage b/TypeScript.YAML-tmLanguage index 1b6750d8..88153718 100644 --- a/TypeScript.YAML-tmLanguage +++ b/TypeScript.YAML-tmLanguage @@ -11,29 +11,30 @@ patterns: repository: var-expr: name: meta.var.expr.ts - begin: (?]|var|type|function|class|interface) + end: (?=$|[,);>]|var|type|function|class|interface) patterns: + - include: '#type-parameters' - include: '#type' + - name: keyword.operator.ts + match: '=\s*' enum-declaration: name: meta.enum.declaration.ts @@ -85,7 +89,7 @@ repository: object-heritage: name: meta.object.heritage.ts - begin: '(?:\b(extends|implements))' + begin: '(?:\b(extends|implements)\b)' beginCaptures: '1': { name: keyword.other.ts } end: (?=\{) @@ -93,12 +97,13 @@ repository: '1': { name: brace.curly.ts } patterns: - include: '#comment' + - include: '#object-heritage' - include: '#type-parameters' - - include: '#object-heritage-parent' + - include: '#object-heritage-type' - object-heritage-parent: + object-heritage-type: name: meta.object.heritage.parent.ts - match: '(?:\s*([a-zA-Z_$][\w$]*))' + match: '(?:\s*([a-zA-Z_$][\w$]*)\b)' captures: '1': { name: storage.type.ts } @@ -139,24 +144,25 @@ repository: field-declaration: name: meta.field.declaration.ts - begin: '(?)' + end: '(?=$)|(>)' endCaptures: '2': { name: meta.brace.angle.ts } patterns: @@ -366,7 +380,7 @@ repository: '1': { name: keyword.operator.ts } end: (?=$|[,);=]) patterns: - - include: '#expression' + - include: '#expression' expression: name: meta.expression.ts @@ -382,6 +396,7 @@ repository: - include: '#declaration' - include: '#cast' - include: '#new-expr' + - include: '#switch-statement' - include: '#block' - include: '#expression-operator' - include: '#relational-operator' @@ -390,9 +405,42 @@ repository: - include: '#assignment-operator' - include: '#storage-keyword' - include: '#function-call' - - include: '#switch-case' + - include: '#case-clause' - include: '#control-statement' - + + switch-expression: + name: switch-expression.expr.ts + begin: \b(switch)\b\s*\( + beginCaptures: + '1': { name: keyword.operator.ts } + end: \) + patterns: + - include: '#expression' + + switch-block: + name: switch-block.expr.ts + begin: '{' + end: (?=\}) + patterns: + - include: '#expression' + + case-clause: + name: case-clause.expr.ts + begin: '(?' character followed by '<' is likely a type assertion, as otherwise its a syntax error - # '<=' and '<<=' are definately not type assertions, as they are assignment operators. - begin: '(?:(?<=return|throw|yield|[=(,:>]))\s*(<)(?!' are followed by a '<', it is also likely a type assertion as otherwise it would be a syntax error + # '<=' and '<<=' are cannot be type assertions, as they are assignment operators. + begin: '(?:(?<=return|throw|yield|await|[=(,:>]))\s*(<)(?!' @@ -441,7 +490,7 @@ repository: expression-operator: name: keyword.operator.ts - match: =>|\b(delete|export|import|in|instanceof|module|namespace|new|typeof|void)\b + match: =>|\b(delete|export|import|from|in|instanceof|new|typeof|void|as)\b arithmetic-operator: name: keyword.operator.arithmetic.ts @@ -457,11 +506,11 @@ repository: logic-operator: name: keyword.operator.arithmetic.ts - match: \!|&|~|\||&&|\|\| + match: \!|&|~|\^|\||&&|\|\| storage-keyword: name: storage.type.ts - match: \b(number|boolean|string|any|var|let|function|const)\b + match: \b(number|boolean|string|any|var|let|function|const|module|namespace)\b paren-expression: begin: \( @@ -476,14 +525,14 @@ repository: qstring-double: name: string.double.ts begin: '"' - end: '"|(?=$)' + end: '"|(?:[^\\\n]$)' patterns: - include: '#string-character-escape' qstring-single: name: string.single.ts begin: "'" - end: "'|(?=$)" + end: \'|(?:[^\\\n]$) patterns: - include: '#string-character-escape' @@ -556,7 +605,7 @@ repository: comment-line: name: comment.line.ts - match: (//).*$ + match: (//).*$\n? literal: name: literal.ts @@ -580,7 +629,7 @@ repository: - include: '#expression' numeric-literal: - name: constant.numeric.ts + name: constant.numeric.ts match: \b(?<=[^$])((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b boolean-literal: @@ -590,11 +639,11 @@ repository: null-literal: name: constant.language.null.ts match: \b(null)\b - + this-literal: name: constant.language.this.ts match: \b(this)\b - + undefined-literal: name: constant.language.ts match: \b(undefined)\b @@ -602,7 +651,7 @@ repository: access-modifier: name: storage.modifier.ts match: \b(public|protected|private)\b - + static-modifier: name: keyword.other.ts match: \b(static)\b @@ -611,4 +660,4 @@ repository: name: storage.type.property.ts match: \b(get|set)\b -... \ No newline at end of file +... diff --git a/TypeScript.tmLanguage b/TypeScript.tmLanguage index ef3dcac9..a267eb14 100644 --- a/TypeScript.tmLanguage +++ b/TypeScript.tmLanguage @@ -70,6 +70,13 @@ name keyword.operator.assignment.ts + await-modifier + + match + \bawait\b + name + storage.modifier.ts + block begin @@ -98,11 +105,11 @@ include - #expression + #object-member include - #object-member + #expression @@ -113,10 +120,34 @@ name constant.language.boolean.ts + case-clause + + begin + (?<!\.)\b(case|default)\b + beginCaptures + + 1 + + name + keyword.control.ts + + + end + : + name + case-clause.expr.ts + patterns + + + include + #expression + + + cast begin - (?:(?<=return|throw|yield|[=(,:>]))\s*(<)(?!<?\=) + (?:(?<=return|throw|yield|await|[=(,:>]))\s*(<)(?!<?\=) beginCaptures 1 @@ -186,7 +217,7 @@ comment-line match - (//).*$ + (//).*$\n? name comment.line.ts @@ -328,6 +359,10 @@ include #new-expr + + include + #switch-statement + include #block @@ -362,7 +397,7 @@ include - #switch-case + #case-clause include @@ -373,14 +408,14 @@ expression-operator match - =>|\b(delete|export|import|in|instanceof|module|namespace|new|typeof|void)\b + =>|\b(delete|export|import|from|in|instanceof|new|typeof|void|as)\b name keyword.operator.ts field-declaration begin - (?<!\()\s*\b([a-zA-Z_$][\w$]*)\s*(\?\s*)?(?=(=|:)) + (?<!\()\s*((?:\b[a-zA-Z_$][\w$]*)|(?:\'[^']*\')|(?:\"[^"]*\"))\s*(\?\s*)?(?=(=|:)) beginCaptures 1 @@ -395,7 +430,7 @@ end - (?=\}|;|,|(?<!=)\n)|(?<=\}) + (?=\}|;|,|$)|(?<=\}) name meta.field.declaration.ts patterns @@ -432,6 +467,10 @@ functioncall.expr.ts patterns + + include + #await-modifier + include #type-parameters @@ -445,7 +484,7 @@ function-declaration begin - \b(?:(export)\s+)?(function\b)(?:\s+([a-zA-Z_$][\w$]*))?\s* + \b(?:(export)\s+)?(?:(async)\s+)?(function\b)(?:\s+([a-zA-Z_$][\w$]*))?\s* beginCaptures 1 @@ -456,9 +495,14 @@ 2 name - storage.type.function.ts + storage.modifier.ts 3 + + name + storage.type.function.ts + + 4 name entity.name.function.ts @@ -660,14 +704,14 @@ logic-operator match - \!|&|~|\||&&|\|\| + \!|&|~|\^|\||&&|\|\| name keyword.operator.arithmetic.ts method-declaration begin - \b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) + \b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) beginCaptures 1 @@ -683,19 +727,24 @@ 3 name - storage.type.property.ts + storage.modifier.ts 4 name - keyword.operator.ts + storage.type.property.ts 5 name - entity.name.function.ts + keyword.operator.ts 6 + + name + entity.name.function.ts + + 7 name keyword.operator.ts @@ -745,21 +794,36 @@ 2 name - keyword.operator.ts + storage.modifier.ts 3 name - entity.name.function.ts + storage.modifier.ts 4 + + name + storage.type.property.ts + + 5 + + name + keyword.operator.ts + + 6 + + name + entity.name.function.ts + + 7 name keyword.operator.ts match - \b(?:(public|private|protected)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) + \b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) name meta.method.overload.declaration.ts @@ -934,7 +998,7 @@ object-heritage begin - (?:\b(extends|implements)) + (?:\b(extends|implements)\b) beginCaptures 1 @@ -961,17 +1025,21 @@ include #comment + + include + #object-heritage + include #type-parameters include - #object-heritage-parent + #object-heritage-type - object-heritage-parent + object-heritage-type captures @@ -982,7 +1050,7 @@ match - (?:\s*([a-zA-Z_$][\w$]*)) + (?:\s*([a-zA-Z_$][\w$]*)\b) name meta.object.heritage.parent.ts @@ -1089,7 +1157,7 @@ begin " end - "|(?=$) + "|(?:[^\\\n]$) name string.double.ts patterns @@ -1105,7 +1173,7 @@ begin ' end - '|(?=$) + \'|(?:[^\\\n]$) name string.single.ts patterns @@ -1173,7 +1241,7 @@ storage-keyword match - \b(number|boolean|string|any|var|let|function|const)\b + \b(number|boolean|string|any|var|let|function|const|module|namespace)\b name storage.type.ts @@ -1200,22 +1268,38 @@ name constant.character.escape - switch-case + switch-block begin - (?<!\.)\b(case|default)\b + { + end + (?=\}) + name + switch-block.expr.ts + patterns + + + include + #expression + + + + switch-expression + + begin + \b(switch)\b\s*\( beginCaptures 1 name - keyword.control.ts + keyword.operator.ts end - : + \) name - case.expr.ts + switch-expression.expr.ts patterns @@ -1224,6 +1308,26 @@ + switch-statement + + begin + (?=\bswitch\b\s*\() + end + } + name + switch-statement.expr.ts + patterns + + + include + #switch-expression + + + include + #switch-block + + + template begin @@ -1382,7 +1486,7 @@ type-declaration begin - \b(type)\b\s+([a-zA-Z_$][\w$]*)\s*=\s* + \b(type)\b\s+([a-zA-Z_$][\w$]*)\s* beginCaptures 1 @@ -1397,15 +1501,25 @@ end - (?=[,);>]|var|type|function|class|interface) + (?=$|[,);>]|var|type|function|class|interface) name meta.type.declaration.ts patterns + + include + #type-parameters + include #type + + match + =\s* + name + keyword.operator.ts + type-function-return-type @@ -1642,7 +1756,7 @@ var-expr begin - (?<!\()\s*\b(var|let|const(?!\s+enum))\s+([a-zA-Z_$][\w$]*) + (?<!\()\s*\b(var|let|const(?!\s+enum)\b) beginCaptures 1 @@ -1650,16 +1764,39 @@ name storage.type.ts - 2 + + end + (?=$|;) + name + meta.var.expr.ts + patterns + + + include + #var-single-variable + + + include + #comment + + + + var-single-variable + + begin + \b([a-zA-Z_$][\w$]*)\s*(=?) + beginCaptures + + 1 name variable.ts end - (?=$|[;=\}\{])|(?<=\}) + (?=$|[;,]) name - meta.var.expr.ts + meta.var-single-variable.expr.ts patterns @@ -1674,6 +1811,10 @@ include #comment + + include + #expression + variable-initializer diff --git a/TypeScriptReact.YAML-tmLanguage b/TypeScriptReact.YAML-tmLanguage index dc57aafa..19eab7f4 100644 --- a/TypeScriptReact.YAML-tmLanguage +++ b/TypeScriptReact.YAML-tmLanguage @@ -1,6 +1,5 @@ # Similar to TypeScript.YAML-tmLanguage except: -# - Remove type assertion (cast.expr.ts) -# - Add the "as" keyword. +# - Remove type assertion (cast.expr.tsx) # - Add JSX expression (HTML-like expression). --- name: TypeScriptReact @@ -14,28 +13,29 @@ patterns: repository: var-expr: name: meta.var.expr.tsx - begin: (?]|var|type|function|class|interface) + end: (?=$|[,);>]|var|type|function|class|interface) patterns: + - include: '#type-parameters' - include: '#type' + - name: keyword.operator.tsx + match: '=\s*' enum-declaration: name: meta.enum.declaration.tsx @@ -88,7 +91,7 @@ repository: object-heritage: name: meta.object.heritage.tsx - begin: '(?:\b(extends|implements))' + begin: '(?:\b(extends|implements)\b)' beginCaptures: '1': { name: keyword.other.tsx } end: (?=\{) @@ -96,12 +99,13 @@ repository: '1': { name: brace.curly.tsx } patterns: - include: '#comment' + - include: '#object-heritage' - include: '#type-parameters' - - include: '#object-heritage-parent' + - include: '#object-heritage-type' - object-heritage-parent: + object-heritage-type: name: meta.object.heritage.parent.tsx - match: '(?:\s*([a-zA-Z_$][\w$]*))' + match: '(?:\s*([a-zA-Z_$][\w$]*)\b)' captures: '1': { name: storage.type.tsx } @@ -142,24 +146,25 @@ repository: field-declaration: name: meta.field.declaration.tsx - begin: '(?)' + end: '(?=$)|(>)' endCaptures: '2': { name: meta.brace.angle.tsx } patterns: @@ -369,7 +382,7 @@ repository: '1': { name: keyword.operator.tsx } end: (?=$|[,);=]) patterns: - - include: '#expression' + - include: '#expression' expression: name: meta.expression.tsx @@ -385,6 +398,7 @@ repository: - include: '#var-expr' - include: '#declaration' - include: '#new-expr' + - include: '#switch-statement' - include: '#block' - include: '#expression-operator' - include: '#relational-operator' @@ -393,9 +407,43 @@ repository: - include: '#assignment-operator' - include: '#storage-keyword' - include: '#function-call' - - include: '#switch-case' + - include: '#case-clause' - include: '#control-statement' - + + switch-expression: + name: switch-expression.expr.tsx + begin: \b(switch)\b\s*\( + beginCaptures: + '1': { name: keyword.operator.tsx } + end: \) + patterns: + - include: '#expression' + + switch-block: + name: switch-block.expr.tsx + begin: '{' + end: (?=\}) + patterns: + - include: '#expression' + + case-clause: + name: case-clause.expr.tsx + begin: '(?|\b(delete|export|import|in|instanceof|module|namespace|new|typeof|void|as)\b + match: =>|\b(delete|export|import|from|in|instanceof|new|typeof|void|as)\b arithmetic-operator: name: keyword.operator.arithmetic.tsx @@ -444,11 +494,11 @@ repository: logic-operator: name: keyword.operator.arithmetic.tsx - match: \!|&|~|\||&&|\|\| + match: \!|&|~|\^|\||&&|\|\| storage-keyword: name: storage.type.tsx - match: \b(number|boolean|string|any|var|let|function|const)\b + match: \b(number|boolean|string|any|var|let|function|const|module|namespace)\b paren-expression: begin: \( @@ -463,14 +513,14 @@ repository: qstring-double: name: string.double.tsx begin: '"' - end: '"|(?=$)' + end: '"|(?:[^\\\n]$)' patterns: - include: '#string-character-escape' qstring-single: name: string.single.tsx begin: "'" - end: "'|(?=$)" + end: \'|(?:[^\\\n]$) patterns: - include: '#string-character-escape' @@ -543,7 +593,7 @@ repository: comment-line: name: comment.line.tsx - match: (//).*$ + match: (//).*$\n? literal: name: literal.tsx @@ -567,7 +617,7 @@ repository: - include: '#expression' numeric-literal: - name: constant.numeric.tsx + name: constant.numeric.tsx match: \b(?<=[^$])((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b boolean-literal: @@ -577,11 +627,11 @@ repository: null-literal: name: constant.language.null.tsx match: \b(null)\b - + this-literal: name: constant.language.this.tsx match: \b(this)\b - + undefined-literal: name: constant.language.tsx match: \b(undefined)\b @@ -589,7 +639,7 @@ repository: access-modifier: name: storage.modifier.tsx match: \b(public|protected|private)\b - + static-modifier: name: keyword.other.tsx match: \b(static)\b @@ -740,4 +790,4 @@ repository: patterns: - include: '#jsx-children' -... \ No newline at end of file +... diff --git a/TypeScriptReact.tmLanguage b/TypeScriptReact.tmLanguage index 73cab2f1..dff86244 100644 --- a/TypeScriptReact.tmLanguage +++ b/TypeScriptReact.tmLanguage @@ -70,6 +70,13 @@ name keyword.operator.assignment.tsx + await-modifier + + match + \bawait\b + name + storage.modifier.tsx + block begin @@ -98,11 +105,11 @@ include - #expression + #object-member include - #object-member + #expression @@ -113,6 +120,30 @@ name constant.language.boolean.tsx + case-clause + + begin + (?<!\.)\b(case|default)\b + beginCaptures + + 1 + + name + keyword.control.tsx + + + end + : + name + case-clause.expr.tsx + patterns + + + include + #expression + + + comment name @@ -154,14 +185,14 @@ comment-line match - (//).*$ + (//).*$\n? name comment.line.tsx control-statement match - (?<!\.)\b(break|catch|continue|debugger|declare|do|else|finally|for|if|return|switch|throw|try|while|with|super|switch|case)\b + (?<!\.)\b(break|catch|continue|debugger|declare|do|else|finally|for|if|return|switch|throw|try|while|with|super|case|default)\b name keyword.control.tsx @@ -296,6 +327,10 @@ include #new-expr + + include + #switch-statement + include #block @@ -330,7 +365,7 @@ include - #switch-case + #case-clause include @@ -341,14 +376,14 @@ expression-operator match - =>|\b(delete|export|import|in|instanceof|module|namespace|new|typeof|void|as)\b + =>|\b(delete|export|import|from|in|instanceof|new|typeof|void|as)\b name keyword.operator.tsx field-declaration begin - (?<!\()\s*\b([a-zA-Z_$][\w$]*)\s*(\?\s*)?(?=(=|:)) + (?<!\()\s*((?:\b[a-zA-Z_$][\w$]*)|(?:\'[^']*\')|(?:\"[^"]*\"))\s*(\?\s*)?(?=(=|:)) beginCaptures 1 @@ -363,7 +398,7 @@ end - (?=\}|;|,|(?<!=)\n)|(?<=\}) + (?=\}|;|,|$)|(?<=\}) name meta.field.declaration.tsx patterns @@ -400,6 +435,10 @@ functioncall.expr.tsx patterns + + include + #await-modifier + include #type-parameters @@ -413,7 +452,7 @@ function-declaration begin - \b(?:(export)\s+)?(function\b)(?:\s+([a-zA-Z_$][\w$]*))?\s* + \b(?:(export)\s+)?(?:(async)\s+)?(function\b)(?:\s+([a-zA-Z_$][\w$]*))?\s* beginCaptures 1 @@ -424,9 +463,14 @@ 2 name - storage.type.function.tsx + storage.modifier.tsx 3 + + name + storage.type.function.tsx + + 4 name entity.name.function.tsx @@ -1026,14 +1070,14 @@ logic-operator match - \!|&|~|\||&&|\|\| + \!|&|~|\^|\||&&|\|\| name keyword.operator.arithmetic.tsx method-declaration begin - \b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) + \b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) beginCaptures 1 @@ -1049,19 +1093,24 @@ 3 name - storage.type.property.tsx + storage.modifier.tsx 4 name - keyword.operator.tsx + storage.type.property.tsx 5 name - entity.name.function.tsx + keyword.operator.tsx 6 + + name + entity.name.function.tsx + + 7 name keyword.operator.tsx @@ -1111,21 +1160,36 @@ 2 name - keyword.operator.tsx + storage.modifier.tsx 3 name - entity.name.function.tsx + storage.modifier.tsx 4 + + name + storage.type.property.tsx + + 5 + + name + keyword.operator.tsx + + 6 + + name + entity.name.function.tsx + + 7 name keyword.operator.tsx match - \b(?:(public|private|protected)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) + \b(?:(abstract)\s+)?\b(?:(public|private|protected)\s+)?\b(?:(async)\s+)?(?:(get|set)\s+)?(?:(new)|(?:([a-zA-Z_$][\.\w$]*)\s*(\??)))?\s*(?=\(|\<) name meta.method.overload.declaration.tsx @@ -1151,6 +1215,10 @@ include #type + + include + #comment + null-literal @@ -1296,7 +1364,7 @@ object-heritage begin - (?:\b(extends|implements)) + (?:\b(extends|implements)\b) beginCaptures 1 @@ -1323,17 +1391,21 @@ include #comment + + include + #object-heritage + include #type-parameters include - #object-heritage-parent + #object-heritage-type - object-heritage-parent + object-heritage-type captures @@ -1344,7 +1416,7 @@ match - (?:\s*([a-zA-Z_$][\w$]*)) + (?:\s*([a-zA-Z_$][\w$]*)\b) name meta.object.heritage.parent.tsx @@ -1451,7 +1523,7 @@ begin " end - "|(?=$) + "|(?:[^\\\n]$) name string.double.tsx patterns @@ -1467,7 +1539,7 @@ begin ' end - '|(?=$) + \'|(?:[^\\\n]$) name string.single.tsx patterns @@ -1535,7 +1607,7 @@ storage-keyword match - \b(number|boolean|string|any|var|let|function|const)\b + \b(number|boolean|string|any|var|let|function|const|module|namespace)\b name storage.type.tsx @@ -1562,22 +1634,38 @@ name constant.character.escape - switch-case + switch-block begin - (?<!\.)\b(case|default)\b + { + end + (?=\}) + name + switch-block.expr.tsx + patterns + + + include + #expression + + + + switch-expression + + begin + \b(switch)\b\s*\( beginCaptures 1 name - keyword.control.tsx + keyword.operator.tsx end - : + \) name - case.expr.tsx + switch-expression.expr.tsx patterns @@ -1586,6 +1674,26 @@ + switch-statement + + begin + (?=\bswitch\b\s*\() + end + } + name + switch-statement.expr.tsx + patterns + + + include + #switch-expression + + + include + #switch-block + + + template begin @@ -1744,7 +1852,7 @@ type-declaration begin - \b(type)\b\s+([a-zA-Z_$][\w$]*)\s*=\s* + \b(type)\b\s+([a-zA-Z_$][\w$]*)\s* beginCaptures 1 @@ -1759,15 +1867,25 @@ end - (?=[,);>]|var|type|function|class|interface) + (?=$|[,);>]|var|type|function|class|interface) name meta.type.declaration.tsx patterns + + include + #type-parameters + include #type + + match + =\s* + name + keyword.operator.tsx + type-function-return-type @@ -2004,7 +2122,7 @@ var-expr begin - (?<!\()\s*\b(var|let|const(?!\s+enum))\s+([a-zA-Z_$][\w$]*) + (?<!\()\s*\b(var|let|const(?!\s+enum)\b) beginCaptures 1 @@ -2012,16 +2130,39 @@ name storage.type.tsx - 2 + + end + (?=$|;) + name + meta.var.expr.tsx + patterns + + + include + #var-single-variable + + + include + #comment + + + + var-single-variable + + begin + \b([a-zA-Z_$][\w$]*)\s*(=?) + beginCaptures + + 1 name variable.tsx end - (?=$|[;=\}\{])|(?<=\}) + (?=$|[;,]) name - meta.var.expr.tsx + meta.var-single-variable.expr.tsx patterns @@ -2036,6 +2177,10 @@ include #comment + + include + #expression + variable-initializer