提交 e4c54be8 编写于 作者: M Martin Aeschlimann

update TypeScript grammar

上级 c640a0ed
......@@ -4,7 +4,7 @@
"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/32208c2b11569d08a925f56fd69d28b18a5cc308",
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/858d33f03943e4ec040e81cbabbc3f7892157c18",
"name": "JavaScript (with React support)",
"scopeName": "source.js",
"patterns": [
......@@ -285,55 +285,112 @@
]
},
"var-expr": {
"name": "meta.var.expr.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?\\b(var|let|const(?!\\s+enum\\b))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.type.js"
}
},
"end": "((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|^\\s*abstract\\b|^\\s*async\\b|^\\s*class\\b|^\\s*const\\b|^\\s*declare\\b|^\\s*enum\\b|^\\s*export\\b|^\\s*function\\b|^\\s*import\\b|^\\s*interface\\b|^\\s*let\\b|^\\s*module\\b|^\\s*namespace\\b|^\\s*return\\b|^\\s*type\\b|^\\s*var\\b)|((?<=\\S)(?<!^const|[^\\._$[:alnum:]]const|^let|[^\\._$[:alnum:]]let|^var|[^\\._$[:alnum:]]var)(?=\\s*$)))",
"patterns": [
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#variable-initializer"
},
{
"include": "#comment"
},
{
"begin": "(,)\\s*(?!\\S)",
"name": "meta.var.expr.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?\\b(var|let)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "punctuation.separator.comma.js"
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.type.js"
}
},
"end": "(?<!,)(((?==|;|}|(\\s+(of|in)\\s+)|^\\s*$))|((?<=\\S)(?=\\s*$)))",
"end": "((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|^\\s*abstract\\b|^\\s*async\\b|^\\s*class\\b|^\\s*const\\b|^\\s*declare\\b|^\\s*enum\\b|^\\s*export\\b|^\\s*function\\b|^\\s*import\\b|^\\s*interface\\b|^\\s*let\\b|^\\s*module\\b|^\\s*namespace\\b|^\\s*return\\b|^\\s*type\\b|^\\s*var\\b)|((?<=\\S)(?<!^let|[^\\._$[:alnum:]]let|^var|[^\\._$[:alnum:]]var)(?=\\s*$)))",
"patterns": [
{
"include": "#comment"
},
{
"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": "#comment"
},
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
"name": "meta.var.expr.js",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?\\b(const(?!\\s+enum\\b))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js"
},
"2": {
"name": "storage.type.js"
}
},
"end": "((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|^\\s*abstract\\b|^\\s*async\\b|^\\s*class\\b|^\\s*const\\b|^\\s*declare\\b|^\\s*enum\\b|^\\s*export\\b|^\\s*function\\b|^\\s*import\\b|^\\s*interface\\b|^\\s*let\\b|^\\s*module\\b|^\\s*namespace\\b|^\\s*return\\b|^\\s*type\\b|^\\s*var\\b)|((?<=\\S)(?<!^const|[^\\._$[:alnum:]]const)(?=\\s*$)))",
"patterns": [
{
"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": "#comment"
},
{
"include": "#destructuring-const"
},
{
"include": "#var-single-const"
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
}
]
}
]
},
......@@ -386,6 +443,40 @@
}
]
},
"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": [
{
......@@ -435,6 +526,42 @@
}
]
},
"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": [
{
......@@ -466,6 +593,37 @@
}
]
},
"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": "(:)",
......@@ -512,6 +670,28 @@
}
]
},
"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": {
......@@ -523,6 +703,17 @@
}
}
},
"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": {
......@@ -545,6 +736,28 @@
}
]
},
"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": {
......@@ -570,6 +783,31 @@
}
]
},
"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": [
{
......
......@@ -4,7 +4,7 @@
"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/32208c2b11569d08a925f56fd69d28b18a5cc308",
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/858d33f03943e4ec040e81cbabbc3f7892157c18",
"name": "JavaScript (with React support)",
"scopeName": "source.js.jsx",
"patterns": [
......@@ -285,55 +285,112 @@
]
},
"var-expr": {
"name": "meta.var.expr.js.jsx",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?\\b(var|let|const(?!\\s+enum\\b))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js.jsx"
},
"2": {
"name": "storage.type.js.jsx"
}
},
"end": "((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|^\\s*abstract\\b|^\\s*async\\b|^\\s*class\\b|^\\s*const\\b|^\\s*declare\\b|^\\s*enum\\b|^\\s*export\\b|^\\s*function\\b|^\\s*import\\b|^\\s*interface\\b|^\\s*let\\b|^\\s*module\\b|^\\s*namespace\\b|^\\s*return\\b|^\\s*type\\b|^\\s*var\\b)|((?<=\\S)(?<!^const|[^\\._$[:alnum:]]const|^let|[^\\._$[:alnum:]]let|^var|[^\\._$[:alnum:]]var)(?=\\s*$)))",
"patterns": [
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#variable-initializer"
},
{
"include": "#comment"
},
{
"begin": "(,)\\s*(?!\\S)",
"name": "meta.var.expr.js.jsx",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?\\b(var|let)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "punctuation.separator.comma.js.jsx"
"name": "keyword.control.export.js.jsx"
},
"2": {
"name": "storage.type.js.jsx"
}
},
"end": "(?<!,)(((?==|;|}|(\\s+(of|in)\\s+)|^\\s*$))|((?<=\\S)(?=\\s*$)))",
"end": "((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|^\\s*abstract\\b|^\\s*async\\b|^\\s*class\\b|^\\s*const\\b|^\\s*declare\\b|^\\s*enum\\b|^\\s*export\\b|^\\s*function\\b|^\\s*import\\b|^\\s*interface\\b|^\\s*let\\b|^\\s*module\\b|^\\s*namespace\\b|^\\s*return\\b|^\\s*type\\b|^\\s*var\\b)|((?<=\\S)(?<!^let|[^\\._$[:alnum:]]let|^var|[^\\._$[:alnum:]]var)(?=\\s*$)))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#variable-initializer"
},
{
"include": "#comment"
},
{
"begin": "(,)\\s*(?!\\S)",
"beginCaptures": {
"1": {
"name": "punctuation.separator.comma.js.jsx"
}
},
"end": "(?<!,)(((?==|;|}|(\\s+(of|in)\\s+)|^\\s*$))|((?<=\\S)(?=\\s*$)))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
"name": "meta.var.expr.js.jsx",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?\\b(const(?!\\s+enum\\b))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "keyword.control.export.js.jsx"
},
"2": {
"name": "storage.type.js.jsx"
}
},
"end": "((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|^\\s*abstract\\b|^\\s*async\\b|^\\s*class\\b|^\\s*const\\b|^\\s*declare\\b|^\\s*enum\\b|^\\s*export\\b|^\\s*function\\b|^\\s*import\\b|^\\s*interface\\b|^\\s*let\\b|^\\s*module\\b|^\\s*namespace\\b|^\\s*return\\b|^\\s*type\\b|^\\s*var\\b)|((?<=\\S)(?<!^const|[^\\._$[:alnum:]]const)(?=\\s*$)))",
"patterns": [
{
"include": "#destructuring-const"
},
{
"include": "#var-single-const"
},
{
"include": "#variable-initializer"
},
{
"include": "#comment"
},
{
"begin": "(,)\\s*(?!\\S)",
"beginCaptures": {
"1": {
"name": "punctuation.separator.comma.js.jsx"
}
},
"end": "(?<!,)(((?==|;|}|(\\s+(of|in)\\s+)|^\\s*$))|((?<=\\S)(?=\\s*$)))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#destructuring-const"
},
{
"include": "#var-single-const"
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
}
]
}
]
},
......@@ -386,6 +443,40 @@
}
]
},
"var-single-const": {
"patterns": [
{
"name": "meta.var-single-variable.expr.js.jsx",
"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.jsx variable.other.constant.js.jsx entity.name.function.js.jsx"
}
},
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#var-single-variable-type-annotation"
}
]
},
{
"name": "meta.var-single-variable.expr.js.jsx",
"begin": "([_$[:alpha:]][_$[:alnum:]]*)",
"beginCaptures": {
"1": {
"name": "meta.definition.variable.js.jsx variable.other.constant.js.jsx"
}
},
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#var-single-variable-type-annotation"
}
]
}
]
},
"var-single-variable-type-annotation": {
"patterns": [
{
......@@ -435,6 +526,42 @@
}
]
},
"destructuring-const": {
"patterns": [
{
"name": "meta.object-binding-pattern-variable.js.jsx",
"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.jsx",
"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": [
{
......@@ -466,6 +593,37 @@
}
]
},
"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": "(:)",
......@@ -512,6 +670,28 @@
}
]
},
"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": {
......@@ -523,6 +703,17 @@
}
}
},
"destructuring-variable-rest-const": {
"match": "(?:(\\.\\.\\.)\\s*)?([_$[:alpha:]][_$[:alnum:]]*)",
"captures": {
"1": {
"name": "keyword.operator.rest.js.jsx"
},
"2": {
"name": "meta.definition.variable.js.jsx variable.other.constant.js.jsx"
}
}
},
"object-binding-pattern": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\{)",
"beginCaptures": {
......@@ -545,6 +736,28 @@
}
]
},
"object-binding-pattern-const": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\{)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.js.jsx"
},
"2": {
"name": "punctuation.definition.binding-pattern.object.js.jsx"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.object.js.jsx"
}
},
"patterns": [
{
"include": "#object-binding-element-const"
}
]
},
"array-binding-pattern": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\[)",
"beginCaptures": {
......@@ -570,6 +783,31 @@
}
]
},
"array-binding-pattern-const": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\[)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.js.jsx"
},
"2": {
"name": "punctuation.definition.binding-pattern.array.js.jsx"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.array.js.jsx"
}
},
"patterns": [
{
"include": "#binding-element-const"
},
{
"include": "#punctuation-comma"
}
]
},
"parameter-name": {
"patterns": [
{
......
......@@ -4,7 +4,7 @@
"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/32208c2b11569d08a925f56fd69d28b18a5cc308",
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/858d33f03943e4ec040e81cbabbc3f7892157c18",
"name": "TypeScript",
"scopeName": "source.ts",
"patterns": [
......@@ -282,55 +282,112 @@
]
},
"var-expr": {
"name": "meta.var.expr.ts",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?\\b(var|let|const(?!\\s+enum\\b))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "keyword.control.export.ts"
},
"2": {
"name": "storage.type.ts"
}
},
"end": "((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|^\\s*abstract\\b|^\\s*async\\b|^\\s*class\\b|^\\s*const\\b|^\\s*declare\\b|^\\s*enum\\b|^\\s*export\\b|^\\s*function\\b|^\\s*import\\b|^\\s*interface\\b|^\\s*let\\b|^\\s*module\\b|^\\s*namespace\\b|^\\s*return\\b|^\\s*type\\b|^\\s*var\\b)|((?<=\\S)(?<!^const|[^\\._$[:alnum:]]const|^let|[^\\._$[:alnum:]]let|^var|[^\\._$[:alnum:]]var)(?=\\s*$)))",
"patterns": [
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#variable-initializer"
},
{
"include": "#comment"
},
{
"begin": "(,)\\s*(?!\\S)",
"name": "meta.var.expr.ts",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?\\b(var|let)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "punctuation.separator.comma.ts"
"name": "keyword.control.export.ts"
},
"2": {
"name": "storage.type.ts"
}
},
"end": "(?<!,)(((?==|;|}|(\\s+(of|in)\\s+)|^\\s*$))|((?<=\\S)(?=\\s*$)))",
"end": "((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|^\\s*abstract\\b|^\\s*async\\b|^\\s*class\\b|^\\s*const\\b|^\\s*declare\\b|^\\s*enum\\b|^\\s*export\\b|^\\s*function\\b|^\\s*import\\b|^\\s*interface\\b|^\\s*let\\b|^\\s*module\\b|^\\s*namespace\\b|^\\s*return\\b|^\\s*type\\b|^\\s*var\\b)|((?<=\\S)(?<!^let|[^\\._$[:alnum:]]let|^var|[^\\._$[:alnum:]]var)(?=\\s*$)))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#variable-initializer"
},
{
"include": "#comment"
},
{
"begin": "(,)\\s*(?!\\S)",
"beginCaptures": {
"1": {
"name": "punctuation.separator.comma.ts"
}
},
"end": "(?<!,)(((?==|;|}|(\\s+(of|in)\\s+)|^\\s*$))|((?<=\\S)(?=\\s*$)))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
"name": "meta.var.expr.ts",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?\\b(const(?!\\s+enum\\b))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "keyword.control.export.ts"
},
"2": {
"name": "storage.type.ts"
}
},
"end": "((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|^\\s*abstract\\b|^\\s*async\\b|^\\s*class\\b|^\\s*const\\b|^\\s*declare\\b|^\\s*enum\\b|^\\s*export\\b|^\\s*function\\b|^\\s*import\\b|^\\s*interface\\b|^\\s*let\\b|^\\s*module\\b|^\\s*namespace\\b|^\\s*return\\b|^\\s*type\\b|^\\s*var\\b)|((?<=\\S)(?<!^const|[^\\._$[:alnum:]]const)(?=\\s*$)))",
"patterns": [
{
"include": "#destructuring-const"
},
{
"include": "#var-single-const"
},
{
"include": "#variable-initializer"
},
{
"include": "#comment"
},
{
"begin": "(,)\\s*(?!\\S)",
"beginCaptures": {
"1": {
"name": "punctuation.separator.comma.ts"
}
},
"end": "(?<!,)(((?==|;|}|(\\s+(of|in)\\s+)|^\\s*$))|((?<=\\S)(?=\\s*$)))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#destructuring-const"
},
{
"include": "#var-single-const"
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
}
]
}
]
},
......@@ -383,6 +440,40 @@
}
]
},
"var-single-const": {
"patterns": [
{
"name": "meta.var-single-variable.expr.ts",
"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*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\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*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\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*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))([^=<>]|=[^<])*\\>)*>\\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.ts variable.other.constant.ts entity.name.function.ts"
}
},
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#var-single-variable-type-annotation"
}
]
},
{
"name": "meta.var-single-variable.expr.ts",
"begin": "([_$[:alpha:]][_$[:alnum:]]*)",
"beginCaptures": {
"1": {
"name": "meta.definition.variable.ts variable.other.constant.ts"
}
},
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#var-single-variable-type-annotation"
}
]
}
]
},
"var-single-variable-type-annotation": {
"patterns": [
{
......@@ -432,6 +523,42 @@
}
]
},
"destructuring-const": {
"patterns": [
{
"name": "meta.object-binding-pattern-variable.ts",
"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.ts",
"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": [
{
......@@ -463,6 +590,37 @@
}
]
},
"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": "(:)",
......@@ -509,6 +667,28 @@
}
]
},
"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": {
......@@ -520,6 +700,17 @@
}
}
},
"destructuring-variable-rest-const": {
"match": "(?:(\\.\\.\\.)\\s*)?([_$[:alpha:]][_$[:alnum:]]*)",
"captures": {
"1": {
"name": "keyword.operator.rest.ts"
},
"2": {
"name": "meta.definition.variable.ts variable.other.constant.ts"
}
}
},
"object-binding-pattern": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\{)",
"beginCaptures": {
......@@ -542,6 +733,28 @@
}
]
},
"object-binding-pattern-const": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\{)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.ts"
},
"2": {
"name": "punctuation.definition.binding-pattern.object.ts"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.object.ts"
}
},
"patterns": [
{
"include": "#object-binding-element-const"
}
]
},
"array-binding-pattern": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\[)",
"beginCaptures": {
......@@ -567,6 +780,31 @@
}
]
},
"array-binding-pattern-const": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\[)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.ts"
},
"2": {
"name": "punctuation.definition.binding-pattern.array.ts"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.array.ts"
}
},
"patterns": [
{
"include": "#binding-element-const"
},
{
"include": "#punctuation-comma"
}
]
},
"parameter-name": {
"patterns": [
{
......
......@@ -4,7 +4,7 @@
"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/32208c2b11569d08a925f56fd69d28b18a5cc308",
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/858d33f03943e4ec040e81cbabbc3f7892157c18",
"name": "TypeScriptReact",
"scopeName": "source.tsx",
"patterns": [
......@@ -285,55 +285,112 @@
]
},
"var-expr": {
"name": "meta.var.expr.tsx",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?\\b(var|let|const(?!\\s+enum\\b))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "keyword.control.export.tsx"
},
"2": {
"name": "storage.type.tsx"
}
},
"end": "((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|^\\s*abstract\\b|^\\s*async\\b|^\\s*class\\b|^\\s*const\\b|^\\s*declare\\b|^\\s*enum\\b|^\\s*export\\b|^\\s*function\\b|^\\s*import\\b|^\\s*interface\\b|^\\s*let\\b|^\\s*module\\b|^\\s*namespace\\b|^\\s*return\\b|^\\s*type\\b|^\\s*var\\b)|((?<=\\S)(?<!^const|[^\\._$[:alnum:]]const|^let|[^\\._$[:alnum:]]let|^var|[^\\._$[:alnum:]]var)(?=\\s*$)))",
"patterns": [
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#variable-initializer"
},
{
"include": "#comment"
},
{
"begin": "(,)\\s*(?!\\S)",
"name": "meta.var.expr.tsx",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?\\b(var|let)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "punctuation.separator.comma.tsx"
"name": "keyword.control.export.tsx"
},
"2": {
"name": "storage.type.tsx"
}
},
"end": "(?<!,)(((?==|;|}|(\\s+(of|in)\\s+)|^\\s*$))|((?<=\\S)(?=\\s*$)))",
"end": "((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|^\\s*abstract\\b|^\\s*async\\b|^\\s*class\\b|^\\s*const\\b|^\\s*declare\\b|^\\s*enum\\b|^\\s*export\\b|^\\s*function\\b|^\\s*import\\b|^\\s*interface\\b|^\\s*let\\b|^\\s*module\\b|^\\s*namespace\\b|^\\s*return\\b|^\\s*type\\b|^\\s*var\\b)|((?<=\\S)(?<!^let|[^\\._$[:alnum:]]let|^var|[^\\._$[:alnum:]]var)(?=\\s*$)))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#variable-initializer"
},
{
"include": "#comment"
},
{
"begin": "(,)\\s*(?!\\S)",
"beginCaptures": {
"1": {
"name": "punctuation.separator.comma.tsx"
}
},
"end": "(?<!,)(((?==|;|}|(\\s+(of|in)\\s+)|^\\s*$))|((?<=\\S)(?=\\s*$)))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#destructuring-variable"
},
{
"include": "#var-single-variable"
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
"name": "meta.var.expr.tsx",
"begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bexport)\\s+)?\\b(const(?!\\s+enum\\b))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
"beginCaptures": {
"1": {
"name": "keyword.control.export.tsx"
},
"2": {
"name": "storage.type.tsx"
}
},
"end": "((?=;|}|(\\s+(of|in)\\s+)|^\\s*$|;|^\\s*abstract\\b|^\\s*async\\b|^\\s*class\\b|^\\s*const\\b|^\\s*declare\\b|^\\s*enum\\b|^\\s*export\\b|^\\s*function\\b|^\\s*import\\b|^\\s*interface\\b|^\\s*let\\b|^\\s*module\\b|^\\s*namespace\\b|^\\s*return\\b|^\\s*type\\b|^\\s*var\\b)|((?<=\\S)(?<!^const|[^\\._$[:alnum:]]const)(?=\\s*$)))",
"patterns": [
{
"include": "#destructuring-const"
},
{
"include": "#var-single-const"
},
{
"include": "#variable-initializer"
},
{
"include": "#comment"
},
{
"begin": "(,)\\s*(?!\\S)",
"beginCaptures": {
"1": {
"name": "punctuation.separator.comma.tsx"
}
},
"end": "(?<!,)(((?==|;|}|(\\s+(of|in)\\s+)|^\\s*$))|((?<=\\S)(?=\\s*$)))",
"patterns": [
{
"include": "#comment"
},
{
"include": "#destructuring-const"
},
{
"include": "#var-single-const"
},
{
"include": "#punctuation-comma"
}
]
},
{
"include": "#punctuation-comma"
}
]
}
]
},
......@@ -386,6 +443,40 @@
}
]
},
"var-single-const": {
"patterns": [
{
"name": "meta.var-single-variable.expr.tsx",
"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.tsx variable.other.constant.tsx entity.name.function.tsx"
}
},
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#var-single-variable-type-annotation"
}
]
},
{
"name": "meta.var-single-variable.expr.tsx",
"begin": "([_$[:alpha:]][_$[:alnum:]]*)",
"beginCaptures": {
"1": {
"name": "meta.definition.variable.tsx variable.other.constant.tsx"
}
},
"end": "(?=$|^|[;,=}]|(\\s+(of|in)\\s+))",
"patterns": [
{
"include": "#var-single-variable-type-annotation"
}
]
}
]
},
"var-single-variable-type-annotation": {
"patterns": [
{
......@@ -435,6 +526,42 @@
}
]
},
"destructuring-const": {
"patterns": [
{
"name": "meta.object-binding-pattern-variable.tsx",
"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.tsx",
"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": [
{
......@@ -466,6 +593,37 @@
}
]
},
"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": "(:)",
......@@ -512,6 +670,28 @@
}
]
},
"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": {
......@@ -523,6 +703,17 @@
}
}
},
"destructuring-variable-rest-const": {
"match": "(?:(\\.\\.\\.)\\s*)?([_$[:alpha:]][_$[:alnum:]]*)",
"captures": {
"1": {
"name": "keyword.operator.rest.tsx"
},
"2": {
"name": "meta.definition.variable.tsx variable.other.constant.tsx"
}
}
},
"object-binding-pattern": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\{)",
"beginCaptures": {
......@@ -545,6 +736,28 @@
}
]
},
"object-binding-pattern-const": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\{)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.tsx"
},
"2": {
"name": "punctuation.definition.binding-pattern.object.tsx"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.object.tsx"
}
},
"patterns": [
{
"include": "#object-binding-element-const"
}
]
},
"array-binding-pattern": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\[)",
"beginCaptures": {
......@@ -570,6 +783,31 @@
}
]
},
"array-binding-pattern-const": {
"begin": "(?:(\\.\\.\\.)\\s*)?(\\[)",
"beginCaptures": {
"1": {
"name": "keyword.operator.rest.tsx"
},
"2": {
"name": "punctuation.definition.binding-pattern.array.tsx"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.definition.binding-pattern.array.tsx"
}
},
"patterns": [
{
"include": "#binding-element-const"
},
{
"include": "#punctuation-comma"
}
]
},
"parameter-name": {
"patterns": [
{
......
......@@ -2960,7 +2960,7 @@
},
{
"c": "t",
"t": "source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.readwrite.ts",
"t": "source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.constant.ts",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
......
......@@ -188,7 +188,7 @@
},
{
"c": "timeRange",
"t": "source.ts meta.function.ts meta.block.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.readwrite.ts",
"t": "source.ts meta.function.ts meta.block.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.constant.ts",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
......
......@@ -111,7 +111,7 @@
},
{
"c": "foo",
"t": "source.ts meta.function.ts meta.block.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts entity.name.function.ts",
"t": "source.ts meta.function.ts meta.block.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.constant.ts entity.name.function.ts",
"r": {
"dark_plus": "entity.name.function: #DCDCAA",
"light_plus": "entity.name.function: #795E26",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册