Permalink
Switch branches/tags
Find file Copy path
10a1d2a Oct 4, 2018
4 contributors

Users who have contributed to this file

@mjbvz @aeschli @sandy081 @bmeck
5234 lines (5234 sloc) 175 KB
{
"information_for_contributors": [
"This file has been converted from https://github.com/Microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage",
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/6e8a3830c29b6f29c06d2de091240e1a880f21aa",
"name": "JavaScript (with React support)",
"scopeName": "source.js",
"patterns": [
{
"include": "#directives"
},
{
"include": "#statements"
},
{
"name": "comment.line.shebang.ts",
"match": "\\A(#!).*(?=$)",
"captures": {
"1": {
"name": "punctuation.definition.comment.ts"
}
}
}
],
"repository": {
"statements": {
"patterns": [
{
"include": "#string"
},
{
"include": "#comment"
},
{
"include": "#declaration"
},
{
"include": "#control-statement"
},
{
"include": "#after-operator-block-as-object-literal"
},
{
"include": "#decl-block"
},
{
"include": "#label"
},
{
"include": "#expression"
},
{
"include": "#punctuation-semicolon"
}
]
},
"declaration": {
"patterns": [
{
"include": "#decorator"
},
{
"include": "#var-expr"
},
{
"include": "#function-declaration"
},
{
"include": "#class-declaration"
},
{
"include": "#interface-declaration"
},
{
"include": "#enum-declaration"
},
{
"include": "#namespace-declaration"
},
{
"include": "#type-alias-declaration"
},
{
"include": "#import-equals-declaration"
},
{
"include": "#import-declaration"
},
{
"include": "#export-declaration"
},
{
"name": "storage.modifier.js",
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(declare|export)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
}
]
},
"control-statement": {
"patterns": [
{
"include": "#switch-statement"
},
{
"include": "#for-loop"
},
{
"name": "keyword.control.trycatch.js",
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(catch|finally|throw|try)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
},
{
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(break|continue|goto)\\s+([_$[:alpha:]][_$[:alnum:]]*)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"captures": {
"1": {
"name": "keyword.control.loop.js"
},
"2": {
"name": "entity.name.label.js"
}
}
},
{
"name": "keyword.control.loop.js",
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(break|continue|do|goto|while)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
},
{
"name": "keyword.control.flow.js",
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(return)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
},
{
"name": "keyword.control.switch.js",
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(case|default|switch)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
},
{
"name": "keyword.control.conditional.js",
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(else|if)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
},
{
"name": "keyword.control.with.js",
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(with)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
},
{
"name": "keyword.control.js",
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(package)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
},
{
"name": "keyword.other.debugger.js",
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(debugger)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
}
]
},
"label": {
"patterns": [
{
"begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(:)(?=\\s*\\{)",
"beginCaptures": {
"1": {
"name": "entity.name.label.js"
},
"2": {
"name": "punctuation.separator.label.js"
}
},
"end": "(?<=\\})",
"patterns": [
{
"include": "#decl-block"
}
]
},
{
"match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(:)",
"captures": {
"1": {
"name": "entity.name.label.js"
},
"2": {
"name": "punctuation.separator.label.js"
}
}
}
]
},
"expression": {
"patterns": [
{
"include": "#expressionWithoutIdentifiers"
},
{
"include": "#identifiers"
},
{
"include": "#expressionPunctuations"
}
]
},
"expressionWithoutIdentifiers": {
"patterns": [
{
"include": "#jsx"
},
{
"include": "#string"
},
{
"include": "#regex"
},
{
"include": "#comment"
},
{
"include": "#function-expression"
},
{
"include": "#class-expression"
},
{
"include": "#arrow-function"
},
{
"include": "#paren-expression-possibly-arrow"
},
{
"include": "#cast"
},
{
"include": "#ternary-expression"
},
{
"include": "#new-expr"
},
{
"include": "#instanceof-expr"
},
{
"include": "#object-literal"
},
{
"include": "#expression-operators"
},
{
"include": "#function-call"
},
{
"include": "#literal"
},
{
"include": "#support-objects"
},
{
"include": "#paren-expression"
}
]
},
"expressionPunctuations": {
"patterns": [
{
"include": "#punctuation-comma"
},
{
"include": "#punctuation-accessor"
}
]
},
"decorator": {
"name": "meta.decorator.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))\\@",
"beginCaptures": {
"0": {
"name": "punctuation.decorator.js"
}
},
"end": "(?=\\s)",
"patterns": [
{
"include": "#expression"
}
]
},
"var-expr": {
"patterns": [
{
"name": "meta.var.expr.js",
"begin": "(?=(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(var|let)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.)))",
"end": "(?!(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(var|let)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.)))((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))|((?<!^let|[^\\._$[:alnum:]]let|^var|[^\\._$[:alnum:]]var)(?=\\s*$)))",
"patterns": [
{
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(var|let)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))\\s*",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "storage.type.js"
}
},
"end": "(?=\\S)"
},
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#variable-initializer"
},
{
"include": "#comment"
},
{
"begin": "(,)\\s*((?!\\S)|(?=\\/\\/))",
"beginCaptures": {
"1": {
"name": "punctuation.separator.comma.js"
}
},
"end": "(?<!,)(((?==|;|}|(\\s+(of|in)\\s+)|^\\s*$))|((?<=\\S)(?=\\s*$)))",
"patterns": [
{
"include": "#single-line-comment-consuming-line-ending"
},
{
"include": "#comment"
},
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
}
]
},
{
"name": "meta.var.expr.js",
"begin": "(?=(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(const(?!\\s+enum\\b))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.)))",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "storage.type.js"
}
},
"end": "(?!(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(const(?!\\s+enum\\b))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.)))((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))|((?<!^const|[^\\._$[:alnum:]]const)(?=\\s*$)))",
"patterns": [
{
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(const(?!\\s+enum\\b))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))\\s*",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "storage.type.js"
}
},
"end": "(?=\\S)"
},
{
"include": "#destructuring-const"
},
{
"include": "#var-single-const"
},
{
"include": "#variable-initializer"
},
{
"include": "#comment"
},
{
"begin": "(,)\\s*((?!\\S)|(?=\\/\\/))",
"beginCaptures": {
"1": {
"name": "punctuation.separator.comma.js"
}
},
"end": "(?<!,)(((?==|;|}|(\\s+(of|in)\\s+)|^\\s*$))|((?<=\\S)(?=\\s*$)))",
"patterns": [
{
"include": "#single-line-comment-consuming-line-ending"
},
{
"include": "#comment"
},
{
"include": "#destructuring-const"
},
{
"include": "#var-single-const"
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
}
]
}
]
},
"var-single-variable": {
"patterns": [
{
"name": "meta.var-single-variable.expr.js",
"begin": "(?x)([_$[:alpha:]][_$[:alnum:]]*)(?=\\s*\n# function assignment |\n(=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$)) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)?\n [(]\\s*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)? # typeparameters\n \\(\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<[^<>]+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$)) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)?\n [(]\\s*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)? # typeparameters\n \\(\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<[^<>]+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))",
"beginCaptures": {
"1": {
"name": "meta.definition.variable.js entity.name.function.js"
}
},
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#var-single-variable-type-annotation"
}
]
},
{
"name": "meta.var-single-variable.expr.js",
"begin": "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])",
"beginCaptures": {
"1": {
"name": "meta.definition.variable.js variable.other.constant.js"
}
},
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#var-single-variable-type-annotation"
}
]
},
{
"name": "meta.var-single-variable.expr.js",
"begin": "([_$[:alpha:]][_$[:alnum:]]*)",
"beginCaptures": {
"1": {
"name": "meta.definition.variable.js variable.other.readwrite.js"
}
},
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#var-single-variable-type-annotation"
}
]
}
]
},
"var-single-const": {
"patterns": [
{
"name": "meta.var-single-variable.expr.js",
"begin": "(?x)([_$[:alpha:]][_$[:alnum:]]*)(?=\\s*\n# function assignment |\n(=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$)) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)?\n [(]\\s*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)? # typeparameters\n \\(\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<[^<>]+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$)) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)?\n [(]\\s*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)? # typeparameters\n \\(\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<[^<>]+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))",
"beginCaptures": {
"1": {
"name": "meta.definition.variable.js variable.other.constant.js entity.name.function.js"
}
},
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#var-single-variable-type-annotation"
}
]
},
{
"name": "meta.var-single-variable.expr.js",
"begin": "([_$[:alpha:]][_$[:alnum:]]*)",
"beginCaptures": {
"1": {
"name": "meta.definition.variable.js variable.other.constant.js"
}
},
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#var-single-variable-type-annotation"
}
]
}
]
},
"var-single-variable-type-annotation": {
"patterns": [
{
"include": "#type-annotation"
},
{
"include": "#string"
},
{
"include": "#comment"
}
]
},
"destructuring-variable": {
"patterns": [
{
"name": "meta.object-binding-pattern-variable.js",
"begin": "(?<!=|:|^of|[^\\._$[:alnum:]]of|^in|[^\\._$[:alnum:]]in)\\s*(?=\\{)",
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#object-binding-pattern"
},
{
"include": "#type-annotation"
},
{
"include": "#comment"
}
]
},
{
"name": "meta.array-binding-pattern-variable.js",
"begin": "(?<!=|:|^of|[^\\._$[:alnum:]]of|^in|[^\\._$[:alnum:]]in)\\s*(?=\\[)",
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#array-binding-pattern"
},
{
"include": "#type-annotation"
},
{
"include": "#comment"
}
]
}
]
},
"destructuring-const": {
"patterns": [
{
"name": "meta.object-binding-pattern-variable.js",
"begin": "(?<!=|:|^of|[^\\._$[:alnum:]]of|^in|[^\\._$[:alnum:]]in)\\s*(?=\\{)",
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#object-binding-pattern-const"
},
{
"include": "#type-annotation"
},
{
"include": "#comment"
}
]
},
{
"name": "meta.array-binding-pattern-variable.js",
"begin": "(?<!=|:|^of|[^\\._$[:alnum:]]of|^in|[^\\._$[:alnum:]]in)\\s*(?=\\[)",
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#array-binding-pattern-const"
},
{
"include": "#type-annotation"
},
{
"include": "#comment"
}
]
}
]
},
"object-binding-element": {
"patterns": [
{
"include": "#comment"
},
{
"begin": "(?x)(?=((\\b(?<!\\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\$))|(\\b(?<!\\$)0(b|B)[01][01_]*\\b(?!\\$))|(\\b(?<!\\$)0(o|O)?[0-7][0-7_]*\\b(?!\\$))|((?<!\\$)(?:\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1.1E+3\n (?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*\\b)| # 1.E+3\n (?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # .1E+3\n (?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1E+3\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*\\b)| # 1.1\n (?:\\b[0-9][0-9_]*(\\.)\\B)| # 1.\n (?:\\B(\\.)[0-9][0-9_]*\\b)| # .1\n (?:\\b[0-9][0-9_]*\\b(?!\\.)) # 1\n)(?!\\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\\'([^\\'\\\\]|\\\\\\'|\\\\)*\\')|(\\\"([^\\\"\\\\]|\\\\\\\"|\\\\)*\\\")|(\\`([^\\`\\\\]|\\\\\\`|\\\\)*\\`)|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(:))",
"end": "(?=,|\\})",
"patterns": [
{
"include": "#object-binding-element-propertyName"
},
{
"include": "#binding-element"
}
]
},
{
"include": "#object-binding-pattern"
},
{
"include": "#destructuring-variable-rest"
},
{
"include": "#variable-initializer"
},
{
"include": "#punctuation-comma"
}
]
},
"object-binding-element-const": {
"patterns": [
{
"include": "#comment"
},
{
"begin": "(?x)(?=((\\b(?<!\\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\$))|(\\b(?<!\\$)0(b|B)[01][01_]*\\b(?!\\$))|(\\b(?<!\\$)0(o|O)?[0-7][0-7_]*\\b(?!\\$))|((?<!\\$)(?:\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1.1E+3\n (?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*\\b)| # 1.E+3\n (?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # .1E+3\n (?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1E+3\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*\\b)| # 1.1\n (?:\\b[0-9][0-9_]*(\\.)\\B)| # 1.\n (?:\\B(\\.)[0-9][0-9_]*\\b)| # .1\n (?:\\b[0-9][0-9_]*\\b(?!\\.)) # 1\n)(?!\\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\\'([^\\'\\\\]|\\\\\\'|\\\\)*\\')|(\\\"([^\\\"\\\\]|\\\\\\\"|\\\\)*\\\")|(\\`([^\\`\\\\]|\\\\\\`|\\\\)*\\`)|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(:))",
"end": "(?=,|\\})",
"patterns": [
{
"include": "#object-binding-element-propertyName"
},
{
"include": "#binding-element-const"
}
]
},
{
"include": "#object-binding-pattern-const"
},
{
"include": "#destructuring-variable-rest-const"
},
{
"include": "#variable-initializer"
},
{
"include": "#punctuation-comma"
}
]
},
"object-binding-element-propertyName": {
"begin": "(?x)(?=((\\b(?<!\\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\$))|(\\b(?<!\\$)0(b|B)[01][01_]*\\b(?!\\$))|(\\b(?<!\\$)0(o|O)?[0-7][0-7_]*\\b(?!\\$))|((?<!\\$)(?:\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1.1E+3\n (?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*\\b)| # 1.E+3\n (?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # .1E+3\n (?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1E+3\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*\\b)| # 1.1\n (?:\\b[0-9][0-9_]*(\\.)\\B)| # 1.\n (?:\\B(\\.)[0-9][0-9_]*\\b)| # .1\n (?:\\b[0-9][0-9_]*\\b(?!\\.)) # 1\n)(?!\\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\\'([^\\'\\\\]|\\\\\\'|\\\\)*\\')|(\\\"([^\\\"\\\\]|\\\\\\\"|\\\\)*\\\")|(\\`([^\\`\\\\]|\\\\\\`|\\\\)*\\`)|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(:))",
"end": "(:)",
"endCaptures": {
"0": {
"name": "punctuation.destructuring.js"
}
},
"patterns": [
{
"include": "#string"
},
{
"include": "#array-literal"
},
{
"include": "#numeric-literal"
},
{
"name": "variable.object.property.js",
"match": "([_$[:alpha:]][_$[:alnum:]]*)"
}
]
},
"binding-element": {
"patterns": [
{
"include": "#comment"
},
{
"include": "#string"
},
{
"include": "#object-binding-pattern"
},
{
"include": "#array-binding-pattern"
},
{
"include": "#destructuring-variable-rest"
},
{
"include": "#variable-initializer"
}
]
},
"binding-element-const": {
"patterns": [
{
"include": "#comment"
},
{
"include": "#string"
},
{
"include": "#object-binding-pattern-const"
},
{
"include": "#array-binding-pattern-const"
},
{
"include": "#destructuring-variable-rest-const"
},
{
"include": "#variable-initializer"
}
]
},
"destructuring-variable-rest": {
"match": "(?:(\\.\\.\\.)\\s*)?([_$[:alpha:]][_$[:alnum:]]*)",
"captures": {
"1": {
"name": "keyword.operator.rest.js"
},
"2": {
"name": "meta.definition.variable.js variable.other.readwrite.js"
}
}
},
"destructuring-variable-rest-const": {
"match": "(?:(\\.\\.\\.)\\s*)?([_$[:alpha:]][_$[:alnum:]]*)",
"captures": {
"1": {
"name": "keyword.operator.rest.js"
},
"2": {
"name": "meta.definition.variable.js variable.other.constant.js"
}
}
},
"object-binding-pattern": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\{)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.js"
},
"2": {
"name": "punctuation.definition.binding-pattern.object.js"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.object.js"
}
},
"patterns": [
{
"include": "#object-binding-element"
}
]
},
"object-binding-pattern-const": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\{)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.js"
},
"2": {
"name": "punctuation.definition.binding-pattern.object.js"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.object.js"
}
},
"patterns": [
{
"include": "#object-binding-element-const"
}
]
},
"array-binding-pattern": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\[)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.js"
},
"2": {
"name": "punctuation.definition.binding-pattern.array.js"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.array.js"
}
},
"patterns": [
{
"include": "#binding-element"
},
{
"include": "#punctuation-comma"
}
]
},
"array-binding-pattern-const": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\[)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.js"
},
"2": {
"name": "punctuation.definition.binding-pattern.array.js"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.array.js"
}
},
"patterns": [
{
"include": "#binding-element-const"
},
{
"include": "#punctuation-comma"
}
]
},
"parameter-name": {
"patterns": [
{
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(public|protected|private|readonly)\\s+(?=(public|protected|private|readonly)\\s+)",
"captures": {
"1": {
"name": "storage.modifier.js"
}
}
},
{
"match": "(?x)(?:(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(public|private|protected|readonly)\\s+)?(?:(\\.\\.\\.)\\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))\\s*(\\??)(?=\\s*\n# function assignment |\n(=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$)) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)?\n [(]\\s*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)? # typeparameters\n \\(\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<[^<>]+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$)) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)?\n [(]\\s*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)? # typeparameters\n \\(\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<[^<>]+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))",
"captures": {
"1": {
"name": "storage.modifier.js"
},
"2": {
"name": "keyword.operator.rest.js"
},
"3": {
"name": "entity.name.function.js variable.language.this.js"
},
"4": {
"name": "entity.name.function.js"
},
"5": {
"name": "keyword.operator.optional.js"
}
}
},
{
"match": "(?x)(?:(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(public|private|protected|readonly)\\s+)?(?:(\\.\\.\\.)\\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))\\s*(\\??)",
"captures": {
"1": {
"name": "storage.modifier.js"
},
"2": {
"name": "keyword.operator.rest.js"
},
"3": {
"name": "variable.parameter.js variable.language.this.js"
},
"4": {
"name": "variable.parameter.js"
},
"5": {
"name": "keyword.operator.optional.js"
}
}
}
]
},
"destructuring-parameter": {
"patterns": [
{
"name": "meta.parameter.object-binding-pattern.js",
"begin": "(?<!=|:)\\s*(?:(\\.\\.\\.)\\s*)?(\\{)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.js"
},
"2": {
"name": "punctuation.definition.binding-pattern.object.js"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.object.js"
}
},
"patterns": [
{
"include": "#parameter-object-binding-element"
}
]
},
{
"name": "meta.paramter.array-binding-pattern.js",
"begin": "(?<!=|:)\\s*(?:(\\.\\.\\.)\\s*)?(\\[)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.js"
},
"2": {
"name": "punctuation.definition.binding-pattern.array.js"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.array.js"
}
},
"patterns": [
{
"include": "#parameter-binding-element"
},
{
"include": "#punctuation-comma"
}
]
}
]
},
"parameter-object-binding-element": {
"patterns": [
{
"include": "#comment"
},
{
"begin": "(?x)(?=((\\b(?<!\\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\$))|(\\b(?<!\\$)0(b|B)[01][01_]*\\b(?!\\$))|(\\b(?<!\\$)0(o|O)?[0-7][0-7_]*\\b(?!\\$))|((?<!\\$)(?:\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1.1E+3\n (?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*\\b)| # 1.E+3\n (?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # .1E+3\n (?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1E+3\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*\\b)| # 1.1\n (?:\\b[0-9][0-9_]*(\\.)\\B)| # 1.\n (?:\\B(\\.)[0-9][0-9_]*\\b)| # .1\n (?:\\b[0-9][0-9_]*\\b(?!\\.)) # 1\n)(?!\\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\\'([^\\'\\\\]|\\\\\\'|\\\\)*\\')|(\\\"([^\\\"\\\\]|\\\\\\\"|\\\\)*\\\")|(\\`([^\\`\\\\]|\\\\\\`|\\\\)*\\`)|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(:))",
"end": "(?=,|\\})",
"patterns": [
{
"include": "#object-binding-element-propertyName"
},
{
"include": "#parameter-binding-element"
}
]
},
{
"include": "#parameter-object-binding-pattern"
},
{
"include": "#destructuring-parameter-rest"
},
{
"include": "#variable-initializer"
},
{
"include": "#punctuation-comma"
}
]
},
"parameter-binding-element": {
"patterns": [
{
"include": "#comment"
},
{
"include": "#string"
},
{
"include": "#parameter-object-binding-pattern"
},
{
"include": "#parameter-array-binding-pattern"
},
{
"include": "#destructuring-parameter-rest"
},
{
"include": "#variable-initializer"
}
]
},
"destructuring-parameter-rest": {
"match": "(?:(\\.\\.\\.)\\s*)?([_$[:alpha:]][_$[:alnum:]]*)",
"captures": {
"1": {
"name": "keyword.operator.rest.js"
},
"2": {
"name": "variable.parameter.js"
}
}
},
"parameter-object-binding-pattern": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\{)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.js"
},
"2": {
"name": "punctuation.definition.binding-pattern.object.js"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.object.js"
}
},
"patterns": [
{
"include": "#parameter-object-binding-element"
}
]
},
"parameter-array-binding-pattern": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\[)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.js"
},
"2": {
"name": "punctuation.definition.binding-pattern.array.js"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.array.js"
}
},
"patterns": [
{
"include": "#parameter-binding-element"
},
{
"include": "#punctuation-comma"
}
]
},
"field-declaration": {
"name": "meta.field.declaration.js",
"begin": "(?x)(?<!\\()(?:(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(readonly)\\s+)?(?=\\s*((\\b(?<!\\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\$))|(\\b(?<!\\$)0(b|B)[01][01_]*\\b(?!\\$))|(\\b(?<!\\$)0(o|O)?[0-7][0-7_]*\\b(?!\\$))|((?<!\\$)(?:\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1.1E+3\n (?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*\\b)| # 1.E+3\n (?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # .1E+3\n (?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1E+3\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*\\b)| # 1.1\n (?:\\b[0-9][0-9_]*(\\.)\\B)| # 1.\n (?:\\B(\\.)[0-9][0-9_]*\\b)| # .1\n (?:\\b[0-9][0-9_]*\\b(?!\\.)) # 1\n)(?!\\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\\'([^\\'\\\\]|\\\\\\'|\\\\)*\\')|(\\\"([^\\\"\\\\]|\\\\\\\"|\\\\)*\\\")|(\\`([^\\`\\\\]|\\\\\\`|\\\\)*\\`)|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:|;|,|$))",
"beginCaptures": {
"1": {
"name": "storage.modifier.js"
}
},
"end": "(?x)(?=\\}|;|,|$|(^(?!\\s*((\\b(?<!\\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\$))|(\\b(?<!\\$)0(b|B)[01][01_]*\\b(?!\\$))|(\\b(?<!\\$)0(o|O)?[0-7][0-7_]*\\b(?!\\$))|((?<!\\$)(?:\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1.1E+3\n (?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*\\b)| # 1.E+3\n (?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # .1E+3\n (?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1E+3\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*\\b)| # 1.1\n (?:\\b[0-9][0-9_]*(\\.)\\B)| # 1.\n (?:\\B(\\.)[0-9][0-9_]*\\b)| # .1\n (?:\\b[0-9][0-9_]*\\b(?!\\.)) # 1\n)(?!\\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\\'([^\\'\\\\]|\\\\\\'|\\\\)*\\')|(\\\"([^\\\"\\\\]|\\\\\\\"|\\\\)*\\\")|(\\`([^\\`\\\\]|\\\\\\`|\\\\)*\\`)|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\?\\s*)?(=|:|;|,|$))))|(?<=\\})",
"patterns": [
{
"include": "#variable-initializer"
},
{
"include": "#type-annotation"
},
{
"include": "#string"
},
{
"include": "#array-literal"
},
{
"include": "#numeric-literal"
},
{
"include": "#comment"
},
{
"match": "(?x)([_$[:alpha:]][_$[:alnum:]]*)(\\?)?(?=(\\?\\s*)?\\s*\n# function assignment |\n(=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$)) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)?\n [(]\\s*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)? # typeparameters\n \\(\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<[^<>]+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$)) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)?\n [(]\\s*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)? # typeparameters\n \\(\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<[^<>]+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))",
"captures": {
"1": {
"name": "meta.definition.property.js entity.name.function.js"
},
"2": {
"name": "keyword.operator.optional.js"
}
}
},
{
"name": "meta.definition.property.js variable.object.property.js",
"match": "[_$[:alpha:]][_$[:alnum:]]*"
},
{
"name": "keyword.operator.optional.js",
"match": "\\?"
}
]
},
"variable-initializer": {
"patterns": [
{
"begin": "(?<!=|!)(=)(?!=)(?=\\s*\\S)",
"beginCaptures": {
"1": {
"name": "keyword.operator.assignment.js"
}
},
"end": "(?=$|^|[,);}\\]])",
"patterns": [
{
"include": "#expression"
}
]
},
{
"begin": "(?<!=|!)(=)(?!=)",
"beginCaptures": {
"1": {
"name": "keyword.operator.assignment.js"
}
},
"end": "(?=[,);}\\]])|(?=^\\s*$)|(?<=\\S)(?<!=)(?=\\s*$)",
"patterns": [
{
"include": "#expression"
}
]
}
]
},
"function-declaration": {
"name": "meta.function.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?(?:(async)\\s+)?(function\\b)(?:\\s*(\\*))?(?:(?:\\s+|(?<=\\*))([_$[:alpha:]][_$[:alnum:]]*))?\\s*",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "storage.modifier.async.js"
},
"4": {
"name": "storage.type.function.js"
},
"5": {
"name": "keyword.generator.asterisk.js"
},
"6": {
"name": "meta.definition.function.js entity.name.function.js"
}
},
"end": "(?=$|^|;)|(?<=\\})",
"patterns": [
{
"include": "#function-name"
},
{
"include": "#function-body"
}
]
},
"function-expression": {
"name": "meta.function.expression.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(async)\\s+)?(function\\b)(?:\\s*(\\*))?(?:(?:\\s+|(?<=\\*))([_$[:alpha:]][_$[:alnum:]]*))?\\s*",
"beginCaptures": {
"1": {
"name": "storage.modifier.async.js"
},
"2": {
"name": "storage.type.function.js"
},
"3": {
"name": "keyword.generator.asterisk.js"
},
"4": {
"name": "meta.definition.function.js entity.name.function.js"
}
},
"end": "(?=;)|(?<=\\})",
"patterns": [
{
"include": "#function-name"
},
{
"include": "#single-line-comment-consuming-line-ending"
},
{
"include": "#function-body"
}
]
},
"function-name": {
"name": "meta.definition.function.js entity.name.function.js",
"match": "[_$[:alpha:]][_$[:alnum:]]*"
},
"function-body": {
"patterns": [
{
"include": "#comment"
},
{
"include": "#type-parameters"
},
{
"include": "#function-parameters"
},
{
"include": "#return-type"
},
{
"include": "#decl-block"
},
{
"name": "keyword.generator.asterisk.js",
"match": "\\*"
}
]
},
"method-declaration": {
"patterns": [
{
"name": "meta.method.declaration.js",
"begin": "(?x)(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:\\b(public|private|protected)\\s+)?(?:\\b(abstract)\\s+)?(?:\\b(async)\\s+)?\\s*\\b(constructor)\\b(?!:)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "storage.modifier.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "storage.modifier.async.js"
},
"4": {
"name": "storage.type.js"
}
},
"end": "(?=\\}|;|,|$)|(?<=\\})",
"patterns": [
{
"include": "#method-declaration-name"
},
{
"include": "#function-body"
}
]
},
{
"name": "meta.method.declaration.js",
"begin": "(?x)(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:\\b(public|private|protected)\\s+)?(?:\\b(abstract)\\s+)?(?:\\b(async)\\s+)?(?:(?:\\s*\\b(new)\\b(?!:)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.)))|(?:(\\*)\\s*)?)(?=\\s*[\\(\\<])",
"beginCaptures": {
"1": {
"name": "storage.modifier.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "storage.modifier.async.js"
},
"4": {
"name": "keyword.operator.new.js"
},
"5": {
"name": "keyword.generator.asterisk.js"
}
},
"end": "(?=\\}|;|,|$)|(?<=\\})",
"patterns": [
{
"include": "#method-declaration-name"
},
{
"include": "#function-body"
}
]
},
{
"name": "meta.method.declaration.js",
"begin": "(?x)(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:\\b(public|private|protected)\\s+)?(?:\\b(abstract)\\s+)?(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)?(?:(\\*)\\s*)?(?=\\s*(((\\b(?<!\\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\$))|(\\b(?<!\\$)0(b|B)[01][01_]*\\b(?!\\$))|(\\b(?<!\\$)0(o|O)?[0-7][0-7_]*\\b(?!\\$))|((?<!\\$)(?:\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1.1E+3\n (?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*\\b)| # 1.E+3\n (?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # .1E+3\n (?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1E+3\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*\\b)| # 1.1\n (?:\\b[0-9][0-9_]*(\\.)\\B)| # 1.\n (?:\\B(\\.)[0-9][0-9_]*\\b)| # .1\n (?:\\b[0-9][0-9_]*\\b(?!\\.)) # 1\n)(?!\\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\\'([^\\'\\\\]|\\\\\\'|\\\\)*\\')|(\\\"([^\\\"\\\\]|\\\\\\\"|\\\\)*\\\")|(\\`([^\\`\\\\]|\\\\\\`|\\\\)*\\`)|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))\\s*[\\(\\<])",
"beginCaptures": {
"1": {
"name": "storage.modifier.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "storage.modifier.async.js"
},
"4": {
"name": "storage.type.property.js"
},
"5": {
"name": "keyword.generator.asterisk.js"
}
},
"end": "(?=\\}|;|,|$)|(?<=\\})",
"patterns": [
{
"include": "#method-declaration-name"
},
{
"include": "#function-body"
}
]
}
]
},
"object-literal-method-declaration": {
"name": "meta.method.declaration.js",
"begin": "(?x)(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)?(?:(\\*)\\s*)?(?=\\s*(((\\b(?<!\\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\$))|(\\b(?<!\\$)0(b|B)[01][01_]*\\b(?!\\$))|(\\b(?<!\\$)0(o|O)?[0-7][0-7_]*\\b(?!\\$))|((?<!\\$)(?:\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1.1E+3\n (?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*\\b)| # 1.E+3\n (?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # .1E+3\n (?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1E+3\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*\\b)| # 1.1\n (?:\\b[0-9][0-9_]*(\\.)\\B)| # 1.\n (?:\\B(\\.)[0-9][0-9_]*\\b)| # .1\n (?:\\b[0-9][0-9_]*\\b(?!\\.)) # 1\n)(?!\\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\\'([^\\'\\\\]|\\\\\\'|\\\\)*\\')|(\\\"([^\\\"\\\\]|\\\\\\\"|\\\\)*\\\")|(\\`([^\\`\\\\]|\\\\\\`|\\\\)*\\`)|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))\\s*[\\(\\<])",
"beginCaptures": {
"1": {
"name": "storage.modifier.async.js"
},
"2": {
"name": "storage.type.property.js"
},
"3": {
"name": "keyword.generator.asterisk.js"
}
},
"end": "(?=\\}|;|,)|(?<=\\})",
"patterns": [
{
"include": "#method-declaration-name"
},
{
"include": "#function-body"
},
{
"begin": "(?x)(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:\\b(async)\\s+)?(?:\\b(get|set)\\s+)?(?:(\\*)\\s*)?(?=\\s*(((\\b(?<!\\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\$))|(\\b(?<!\\$)0(b|B)[01][01_]*\\b(?!\\$))|(\\b(?<!\\$)0(o|O)?[0-7][0-7_]*\\b(?!\\$))|((?<!\\$)(?:\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1.1E+3\n (?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*\\b)| # 1.E+3\n (?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # .1E+3\n (?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1E+3\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*\\b)| # 1.1\n (?:\\b[0-9][0-9_]*(\\.)\\B)| # 1.\n (?:\\B(\\.)[0-9][0-9_]*\\b)| # .1\n (?:\\b[0-9][0-9_]*\\b(?!\\.)) # 1\n)(?!\\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\\'([^\\'\\\\]|\\\\\\'|\\\\)*\\')|(\\\"([^\\\"\\\\]|\\\\\\\"|\\\\)*\\\")|(\\`([^\\`\\\\]|\\\\\\`|\\\\)*\\`)|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??))\\s*[\\(\\<])",
"beginCaptures": {
"1": {
"name": "storage.modifier.async.js"
},
"2": {
"name": "storage.type.property.js"
},
"3": {
"name": "keyword.generator.asterisk.js"
}
},
"end": "(?=\\(|\\<)",
"patterns": [
{
"include": "#method-declaration-name"
}
]
}
]
},
"method-declaration-name": {
"begin": "(?x)(?=((\\b(?<!\\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\$))|(\\b(?<!\\$)0(b|B)[01][01_]*\\b(?!\\$))|(\\b(?<!\\$)0(o|O)?[0-7][0-7_]*\\b(?!\\$))|((?<!\\$)(?:\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1.1E+3\n (?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*\\b)| # 1.E+3\n (?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # .1E+3\n (?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1E+3\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*\\b)| # 1.1\n (?:\\b[0-9][0-9_]*(\\.)\\B)| # 1.\n (?:\\B(\\.)[0-9][0-9_]*\\b)| # .1\n (?:\\b[0-9][0-9_]*\\b(?!\\.)) # 1\n)(?!\\$))|([_$[:alpha:]][_$[:alnum:]]*)|(\\'([^\\'\\\\]|\\\\\\'|\\\\)*\\')|(\\\"([^\\\"\\\\]|\\\\\\\"|\\\\)*\\\")|(\\`([^\\`\\\\]|\\\\\\`|\\\\)*\\`)|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\]))\\s*(\\??)\\s*[\\(\\<])",
"end": "(?=\\(|\\<)",
"patterns": [
{
"include": "#string"
},
{
"include": "#array-literal"
},
{
"include": "#numeric-literal"
},
{
"name": "meta.definition.method.js entity.name.function.js",
"match": "[_$[:alpha:]][_$[:alnum:]]*"
},
{
"name": "keyword.operator.optional.js",
"match": "\\?"
}
]
},
"arrow-function": {
"patterns": [
{
"name": "meta.arrow.js",
"match": "(?:(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(\\basync)\\s+)?([_$[:alpha:]][_$[:alnum:]]*)\\s*(?==>)",
"captures": {
"1": {
"name": "storage.modifier.async.js"
},
"2": {
"name": "variable.parameter.js"
}
}
},
{
"name": "meta.arrow.js",
"begin": "(?x) (?:\n (?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(\\basync)\n)? ((?<![})!\\]])\\s*\n (?=\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)?\n [(]\\s*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)? # typeparameters\n \\(\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<[^<>]+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n )\n)",
"beginCaptures": {
"1": {
"name": "storage.modifier.async.js"
}
},
"end": "(?==>|\\{|(^\\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\\s+))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#type-parameters"
},
{
"include": "#function-parameters"
},
{
"include": "#arrow-return-type"
}
]
},
{
"name": "meta.arrow.js",
"begin": "=>",
"beginCaptures": {
"0": {
"name": "storage.type.function.arrow.js"
}
},
"end": "(?<=\\}|\\S)(?<!=>)|((?!\\{)(?=\\S))",
"patterns": [
{
"include": "#decl-block"
},
{
"include": "#expression"
}
]
}
]
},
"indexer-declaration": {
"name": "meta.indexer.declaration.js",
"begin": "(?:(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(readonly)\\s*)?\\s*(\\[)\\s*([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=:)",
"beginCaptures": {
"1": {
"name": "storage.modifier.js"
},
"2": {
"name": "meta.brace.square.js"
},
"3": {
"name": "variable.parameter.js"
}
},
"end": "(\\])\\s*(\\?\\s*)?|$",
"endCaptures": {
"1": {
"name": "meta.brace.square.js"
},
"2": {
"name": "keyword.operator.optional.js"
}
},
"patterns": [
{
"include": "#type-annotation"
}
]
},
"indexer-mapped-type-declaration": {
"name": "meta.indexer.mappedtype.declaration.js",
"begin": "(?:(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))([+-])?(readonly)\\s*)?\\s*(\\[)\\s*([_$[:alpha:]][_$[:alnum:]]*)\\s+(in)\\s+",
"beginCaptures": {
"1": {
"name": "keyword.operator.type.modifier.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "meta.brace.square.js"
},
"4": {
"name": "entity.name.type.js"
},
"5": {
"name": "keyword.operator.expression.in.js"
}
},
"end": "(\\])([+-])?\\s*(\\?\\s*)?|$",
"endCaptures": {
"1": {
"name": "meta.brace.square.js"
},
"2": {
"name": "keyword.operator.type.modifier.js"
},
"3": {
"name": "keyword.operator.optional.js"
}
},
"patterns": [
{
"include": "#type"
}
]
},
"function-parameters": {
"name": "meta.parameters.js",
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.parameters.begin.js"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.parameters.end.js"
}
},
"patterns": [
{
"include": "#function-parameters-body"
}
]
},
"function-parameters-body": {
"patterns": [
{
"include": "#comment"
},
{
"include": "#string"
},
{
"include": "#decorator"
},
{
"include": "#destructuring-parameter"
},
{
"include": "#parameter-name"
},
{
"include": "#type-annotation"
},
{
"include": "#variable-initializer"
},
{
"name": "punctuation.separator.parameter.js",
"match": ","
}
]
},
"class-declaration": {
"name": "meta.class.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(?:(abstract)\\s+)?\\b(class)\\b(?=\\s+|/[/*])",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "storage.modifier.js"
},
"4": {
"name": "storage.type.class.js"
}
},
"end": "(?<=\\})",
"patterns": [
{
"include": "#class-declaration-or-expression-patterns"
}
]
},
"class-expression": {
"name": "meta.class.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(class)\\b(?=\\s+|[<{]|\\/[\\/*])",
"beginCaptures": {
"1": {
"name": "storage.type.class.js"
}
},
"end": "(?<=\\})",
"patterns": [
{
"include": "#class-declaration-or-expression-patterns"
}
]
},
"class-declaration-or-expression-patterns": {
"patterns": [
{
"include": "#comment"
},
{
"include": "#class-or-interface-heritage"
},
{
"match": "[_$[:alpha:]][_$[:alnum:]]*",
"captures": {
"0": {
"name": "entity.name.type.class.js"
}
}
},
{
"include": "#type-parameters"
},
{
"include": "#class-or-interface-body"
}
]
},
"interface-declaration": {
"name": "meta.interface.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(?:(abstract)\\s+)?\\b(interface)\\b(?=\\s+|/[/*])",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "storage.modifier.js"
},
"4": {
"name": "storage.type.interface.js"
}
},
"end": "(?<=\\})",
"patterns": [
{
"include": "#comment"
},
{
"include": "#class-or-interface-heritage"
},
{
"match": "[_$[:alpha:]][_$[:alnum:]]*",
"captures": {
"0": {
"name": "entity.name.type.interface.js"
}
}
},
{
"include": "#type-parameters"
},
{
"include": "#class-or-interface-body"
}
]
},
"class-or-interface-heritage": {
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:\\b(extends|implements)\\b)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "storage.modifier.js"
}
},
"end": "(?=\\{)",
"patterns": [
{
"include": "#comment"
},
{
"include": "#class-or-interface-heritage"
},
{
"include": "#type-parameters"
},
{
"include": "#expressionWithoutIdentifiers"
},
{
"match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))(?=\\s*[_$[:alpha:]][_$[:alnum:]]*(\\s*\\??\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)*\\s*)",
"captures": {
"1": {
"name": "entity.name.type.module.js"
},
"2": {
"name": "punctuation.accessor.js"
},
"3": {
"name": "punctuation.accessor.optional.js"
}
}
},
{
"match": "([_$[:alpha:]][_$[:alnum:]]*)",
"captures": {
"1": {
"name": "entity.other.inherited-class.js"
}
}
},
{
"include": "#expressionPunctuations"
}
]
},
"class-or-interface-body": {
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"patterns": [
{
"include": "#comment"
},
{
"include": "#decorator"
},
{
"include": "#method-declaration"
},
{
"include": "#indexer-declaration"
},
{
"include": "#field-declaration"
},
{
"include": "#string"
},
{
"include": "#type-annotation"
},
{
"include": "#variable-initializer"
},
{
"include": "#access-modifier"
},
{
"include": "#property-accessor"
},
{
"include": "#async-modifier"
},
{
"include": "#after-operator-block-as-object-literal"
},
{
"include": "#decl-block"
},
{
"include": "#expression"
},
{
"include": "#punctuation-comma"
},
{
"include": "#punctuation-semicolon"
}
]
},
"access-modifier": {
"name": "storage.modifier.js",
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(abstract|public|protected|private|readonly|static)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
},
"property-accessor": {
"name": "storage.type.property.js",
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(get|set)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
},
"async-modifier": {
"name": "storage.modifier.async.js",
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(async)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))"
},
"enum-declaration": {
"name": "meta.enum.declaration.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?(?:\\b(const)\\s+)?\\b(enum)\\s+([_$[:alpha:]][_$[:alnum:]]*)",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "storage.modifier.js"
},
"4": {
"name": "storage.type.enum.js"
},
"5": {
"name": "entity.name.type.enum.js"
}
},
"end": "(?<=\\})",
"patterns": [
{
"include": "#comment"
},
{
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"patterns": [
{
"include": "#comment"
},
{
"begin": "([_$[:alpha:]][_$[:alnum:]]*)",
"beginCaptures": {
"0": {
"name": "variable.other.enummember.js"
}
},
"end": "(?=,|\\}|$)",
"patterns": [
{
"include": "#comment"
},
{
"include": "#variable-initializer"
}
]
},
{
"begin": "(?=((\\'([^\\'\\\\]|\\\\\\'|\\\\)*\\')|(\\\"([^\\\"\\\\]|\\\\\\\"|\\\\)*\\\")|(\\`([^\\`\\\\]|\\\\\\`|\\\\)*\\`)|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\])))",
"end": "(?=,|\\}|$)",
"patterns": [
{
"include": "#string"
},
{
"include": "#array-literal"
},
{
"include": "#comment"
},
{
"include": "#variable-initializer"
}
]
},
{
"include": "#punctuation-comma"
}
]
}
]
},
"namespace-declaration": {
"name": "meta.namespace.declaration.js",
"begin": "(?:(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(namespace|module)\\s+(?=[_$[:alpha:]\"'`]))",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "storage.type.namespace.js"
}
},
"end": "(?<=\\})|(?=;|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#string"
},
{
"name": "entity.name.type.module.js",
"match": "([_$[:alpha:]][_$[:alnum:]]*)"
},
{
"include": "#punctuation-accessor"
},
{
"include": "#decl-block"
}
]
},
"type-alias-declaration": {
"name": "meta.type.declaration.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(type)\\b\\s+([_$[:alpha:]][_$[:alnum:]]*)\\s*",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "storage.type.type.js"
},
"4": {
"name": "entity.name.type.alias.js"
}
},
"end": "(?=\\}|;|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#type-parameters"
},
{
"begin": "(=)\\s*",
"beginCaptures": {
"1": {
"name": "keyword.operator.assignment.js"
}
},
"end": "(?=\\}|;|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
"patterns": [
{
"include": "#type"
}
]
}
]
},
"import-equals-declaration": {
"patterns": [
{
"name": "meta.import-equals.external.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(import)\\s+([_$[:alpha:]][_$[:alnum:]]*)\\s*(=)\\s*(require)\\s*(\\()",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "keyword.control.import.js"
},
"4": {
"name": "variable.other.readwrite.alias.js"
},
"5": {
"name": "keyword.operator.assignment.js"
},
"6": {
"name": "keyword.control.require.js"
},
"7": {
"name": "meta.brace.round.js"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "meta.brace.round.js"
}
},
"patterns": [
{
"include": "#comment"
},
{
"include": "#string"
}
]
},
{
"name": "meta.import-equals.internal.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(import)\\s+([_$[:alpha:]][_$[:alnum:]]*)\\s*(=)\\s*(?!require\\b)",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "keyword.control.import.js"
},
"4": {
"name": "variable.other.readwrite.alias.js"
},
"5": {
"name": "keyword.operator.assignment.js"
}
},
"end": "(?=;|$|^)",
"patterns": [
{
"include": "#comment"
},
{
"match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))",
"captures": {
"1": {
"name": "entity.name.type.module.js"
},
"2": {
"name": "punctuation.accessor.js"
},
"3": {
"name": "punctuation.accessor.optional.js"
}
}
},
{
"name": "variable.other.readwrite.js",
"match": "([_$[:alpha:]][_$[:alnum:]]*)"
}
]
}
]
},
"import-declaration": {
"name": "meta.import.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?(?:(\\bdeclare)\\s+)?\\b(import)(?!\\s*[:\\(])(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.modifier.js"
},
"3": {
"name": "keyword.control.import.js"
}
},
"end": "(?<!^import|[^\\._$[:alnum:]]import)(?=;|$|^)",
"patterns": [
{
"include": "#comment"
},
{
"include": "#string"
},
{
"begin": "(?<=^import|[^\\._$[:alnum:]]import)(?!\\s*[\"'])",
"end": "\\bfrom\\b",
"endCaptures": {
"0": {
"name": "keyword.control.from.js"
}
},
"patterns": [
{
"include": "#import-export-declaration"
}
]
},
{
"include": "#import-export-declaration"
}
]
},
"export-declaration": {
"patterns": [
{
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(export)\\s+(as)\\s+(namespace)\\s+([_$[:alpha:]][_$[:alnum:]]*)",
"captures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "keyword.control.as.js"
},
"3": {
"name": "storage.type.namespace.js"
},
"4": {
"name": "entity.name.type.module.js"
}
}
},
{
"name": "meta.export.default.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(export)(?:(?:\\s*(=))|(?:\\s+(default)(?=\\s+)))",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "keyword.operator.assignment.js"
},
"3": {
"name": "keyword.control.default.js"
}
},
"end": "(?=$|;|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
"patterns": [
{
"include": "#interface-declaration"
},
{
"include": "#expression"
}
]
},
{
"name": "meta.export.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(export)\\b(?!(\\$)|(\\s*:))((?=\\s*[\\{*])|((?=\\s*[_$[:alpha:]][_$[:alnum:]]*(\\s|,))(?!\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b)))",
"beginCaptures": {
"0": {
"name": "keyword.control.export.js"
}
},
"end": "(?=$|;|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|type|var)\\b))",
"patterns": [
{
"include": "#import-export-declaration"
}
]
}
]
},
"import-export-declaration": {
"patterns": [
{
"include": "#comment"
},
{
"include": "#string"
},
{
"include": "#import-export-block"
},
{
"name": "keyword.control.from.js",
"match": "\\bfrom\\b"
},
{
"include": "#import-export-clause"
}
]
},
"import-export-block": {
"name": "meta.block.js",
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"patterns": [
{
"include": "#import-export-clause"
}
]
},
"import-export-clause": {
"patterns": [
{
"include": "#comment"
},
{
"match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bdefault)|(\\*)|(\\b[_$[:alpha:]][_$[:alnum:]]*))\\s+(as)\\s+(?:(default(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.)))|([_$[:alpha:]][_$[:alnum:]]*))",
"captures": {
"1": {
"name": "keyword.control.default.js"
},
"2": {
"name": "constant.language.import-export-all.js"
},
"3": {
"name": "variable.other.readwrite.js"
},
"4": {
"name": "keyword.control.as.js"
},
"5": {
"name": "keyword.control.default.js"
},
"6": {
"name": "variable.other.readwrite.alias.js"
}
}
},
{
"include": "#punctuation-comma"
},
{
"name": "constant.language.import-export-all.js",
"match": "\\*"
},
{
"name": "keyword.control.default.js",
"match": "\\b(default)\\b"
},
{
"name": "variable.other.readwrite.alias.js",
"match": "([_$[:alpha:]][_$[:alnum:]]*)"
}
]
},
"switch-statement": {
"name": "switch-statement.expr.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?=\\bswitch\\s*\\()",
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"patterns": [
{
"include": "#comment"
},
{
"name": "switch-expression.expr.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(switch)\\s*(\\()",
"beginCaptures": {
"1": {
"name": "keyword.control.switch.js"
},
"2": {
"name": "meta.brace.round.js"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "meta.brace.round.js"
}
},
"patterns": [
{
"include": "#expression"
}
]
},
{
"name": "switch-block.expr.js",
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"end": "(?=\\})",
"patterns": [
{
"name": "case-clause.expr.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(case|default(?=:))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "keyword.control.switch.js"
}
},
"end": "(?=:)",
"patterns": [
{
"include": "#expression"
}
]
},
{
"begin": "(:)\\s*(\\{)",
"beginCaptures": {
"1": {
"name": "case-clause.expr.js punctuation.definition.section.case-statement.js"
},
"2": {
"name": "meta.block.js punctuation.definition.block.js"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "meta.block.js punctuation.definition.block.js"
}
},
"contentName": "meta.block.js",
"patterns": [
{
"include": "#statements"
}
]
},
{
"match": "(:)",
"captures": {
"0": {
"name": "case-clause.expr.js punctuation.definition.section.case-statement.js"
}
}
},
{
"include": "#statements"
}
]
}
]
},
"for-loop": {
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))for(?=((\\s+|(\\s*\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*))await)?\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)?(\\())",
"beginCaptures": {
"0": {
"name": "keyword.control.loop.js"
}
},
"end": "(?<=\\))",
"patterns": [
{
"include": "#comment"
},
{
"name": "keyword.control.loop.js",
"match": "await"
},
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "meta.brace.round.js"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "meta.brace.round.js"
}
},
"patterns": [
{
"include": "#var-expr"
},
{
"include": "#expression"
},
{
"include": "#punctuation-semicolon"
}
]
}
]
},
"decl-block": {
"name": "meta.block.js",
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"patterns": [
{
"include": "#statements"
}
]
},
"after-operator-block-as-object-literal": {
"name": "meta.objectliteral.js",
"begin": "(?<!\\+\\+|--)(?<=[:=(,\\[?+!>]|^await|[^\\._$[:alnum:]]await|^return|[^\\._$[:alnum:]]return|^yield|[^\\._$[:alnum:]]yield|^throw|[^\\._$[:alnum:]]throw|^in|[^\\._$[:alnum:]]in|^of|[^\\._$[:alnum:]]of|^typeof|[^\\._$[:alnum:]]typeof|&&|\\|\\||\\*)\\s*(\\{)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.block.js"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"patterns": [
{
"include": "#object-member"
}
]
},
"object-literal": {
"name": "meta.objectliteral.js",
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.block.js"
}
},
"patterns": [
{
"include": "#object-member"
}
]
},
"object-member": {
"patterns": [
{
"include": "#comment"
},
{
"include": "#object-literal-method-declaration"
},
{
"name": "meta.object.member.js meta.object-literal.key.js",
"begin": "(?=\\[)",
"end": "(?=:)|((?<=[\\]])(?=\\s*[\\(\\<]))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#array-literal"
}
]
},
{
"name": "meta.object.member.js meta.object-literal.key.js",
"begin": "(?=[\\'\\\"])",
"end": "(?=:)|((?<=[\\'\\\"])(?=\\s*[\\(\\<]))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#string"
}
]
},
{
"name": "meta.method.declaration.js",
"begin": "(?<=[\\]\\'\\\"])(?=\\s*[\\(\\<])",
"end": "(?=\\}|;|,)|(?<=\\})",
"patterns": [
{
"include": "#function-body"
}
]
},
{
"name": "meta.object.member.js",
"match": "(?![_$[:alpha:]])([[:digit:]]+)\\s*(?=(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*:)",
"captures": {
"0": {
"name": "meta.object-literal.key.js"
},
"1": {
"name": "constant.numeric.decimal.js"
}
}
},
{
"name": "meta.object.member.js",
"match": "(?x)(?:([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*:(\\s*\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/)*\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*([\\{\\[]\\s*)?$)) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)?\n [(]\\s*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)? # typeparameters\n \\(\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\)))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<[^<>]+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))",
"captures": {
"0": {
"name": "meta.object-literal.key.js"
},
"1": {
"name": "entity.name.function.js"
}
}
},
{
"name": "meta.object.member.js",
"match": "(?:[_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*:)",
"captures": {
"0": {
"name": "meta.object-literal.key.js"
}
}
},
{
"name": "meta.object.member.js",
"begin": "\\.\\.\\.",
"beginCaptures": {
"0": {
"name": "keyword.operator.spread.js"
}
},
"end": "(?=,|\\})",
"patterns": [
{
"include": "#expression"
}
]
},
{
"name": "meta.object.member.js",
"match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=,|\\}|$|\\/\\/|\\/\\*)",
"captures": {
"1": {
"name": "variable.other.readwrite.js"
}
}
},
{
"name": "meta.object.member.js",
"begin": "(?=[_$[:alpha:]][_$[:alnum:]]*\\s*=)",
"end": "(?=,|\\}|$|\\/\\/|\\/\\*)",
"patterns": [
{
"include": "#expression"
}
]
},
{
"name": "meta.object.member.js",
"begin": ":",
"beginCaptures": {
"0": {
"name": "meta.object-literal.key.js punctuation.separator.key-value.js"
}
},
"end": "(?=,|\\})",
"patterns": [
{
"begin": "(?<=:)\\s*(async)?(?=\\s*(<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\s*)\\(\\s*([\\{\\[]\\s*)?$)",
"beginCaptures": {
"1": {
"name": "storage.modifier.async.js"
}
},
"end": "(?<=\\))",
"patterns": [
{
"include": "#type-parameters"
},
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "meta.brace.round.js"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "meta.brace.round.js"
}
},
"patterns": [
{
"include": "#expression-inside-possibly-arrow-parens"
}
]
}
]
},
{
"begin": "(?<=:)\\s*(async)?\\s*(\\()(?=\\s*([\\{\\[]\\s*)?$)",
"beginCaptures": {
"1": {
"name": "storage.modifier.async.js"
},
"2": {
"name": "meta.brace.round.js"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "meta.brace.round.js"
}
},
"patterns": [
{
"include": "#expression-inside-possibly-arrow-parens"
}
]
},
{
"include": "#expression"
}
]
},
{
"include": "#punctuation-comma"
}
]
},
"ternary-expression": {
"begin": "(?!\\?\\.\\s*[^[:digit:]])(\\?)",
"beginCaptures": {
"1": {
"name": "keyword.operator.ternary.js"
}
},
"end": "\\s*(:)",
"endCaptures": {
"1": {
"name": "keyword.operator.ternary.js"
}
},
"patterns": [
{
"include": "#expression"
}
]
},
"function-call": {
"begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\\s*(\\?\\.\\s*)?(<\\s*(((keyof|infer)\\s+)|(\\*(?=\\s*[,>]))|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer)\\s+)|(\\*(?=\\s*[,>]))|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>\\s*)?\\()",
"end": "(?<=\\))(?!(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\\s*(\\?\\.\\s*)?(<\\s*(((keyof|infer)\\s+)|(\\*(?=\\s*[,>]))|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer)\\s+)|(\\*(?=\\s*[,>]))|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>\\s*)?\\()",
"patterns": [
{
"name": "meta.function-call.js",
"begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))",
"end": "(?=\\s*(\\?\\.\\s*)?(<\\s*(((keyof|infer)\\s+)|(\\*(?=\\s*[,>]))|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer)\\s+)|(\\*(?=\\s*[,>]))|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\])|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>\\s*)?\\()",
"patterns": [
{
"include": "#literal"
},
{
"include": "#support-objects"
},
{
"include": "#object-identifiers"
},
{
"include": "#punctuation-accessor"
},
{
"name": "keyword.operator.expression.import.js",
"match": "(?:(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))import(?=\\s*[\\(]\\s*[\\\"\\'\\`]))"
},
{
"name": "entity.name.function.js",
"match": "([_$[:alpha:]][_$[:alnum:]]*)"
}
]
},
{
"include": "#comment"
},
{
"name": "meta.function-call.js punctuation.accessor.optional.js",
"match": "\\?\\."
},
{
"include": "#type-arguments"
},
{
"include": "#paren-expression"
}
]
},
"new-expr": {
"name": "new.expr.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(new)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!