From b391f5bd72d97ce2056eacf2355a85bd7ad77f54 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 13 Mar 2018 15:11:22 -0700 Subject: [PATCH] Update grammars --- .../syntaxes/JavaScript.tmLanguage.json | 162 +++++++----------- .../syntaxes/JavaScriptReact.tmLanguage.json | 162 +++++++----------- .../syntaxes/TypeScript.tmLanguage.json | 51 +++--- .../syntaxes/TypeScriptReact.tmLanguage.json | 162 +++++++----------- 4 files changed, 225 insertions(+), 312 deletions(-) diff --git a/extensions/javascript/syntaxes/JavaScript.tmLanguage.json b/extensions/javascript/syntaxes/JavaScript.tmLanguage.json index 2eefaaae634..3d0c9aa8119 100644 --- a/extensions/javascript/syntaxes/JavaScript.tmLanguage.json +++ b/extensions/javascript/syntaxes/JavaScript.tmLanguage.json @@ -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/a7080b7f47b21f898d731feefb89813f66d00426", + "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/874564b73c579ea678697492f26dd925a3ce738f", "name": "JavaScript (with React support)", "scopeName": "source.js", "patterns": [ @@ -2137,27 +2137,7 @@ "match": "\\?\\." }, { - "name": "meta.type.parameters.js", - "begin": "\\<", - "beginCaptures": { - "0": { - "name": "punctuation.definition.typeparameters.begin.js" - } - }, - "end": "\\>", - "endCaptures": { - "0": { - "name": "punctuation.definition.typeparameters.end.js" - } - }, - "patterns": [ - { - "include": "#type" - }, - { - "include": "#punctuation-comma" - } - ] + "include": "#type-arguments" }, { "include": "#paren-expression" @@ -2354,7 +2334,7 @@ "match": "%|\\*|/|-|\\+" }, { - "match": "(?<=[_$[:alnum:])])\\s*(/)(?![/*])", + "match": "(?<=[_$[:alnum:])\\]])\\s*(/)(?![/*])", "captures": { "1": { "name": "keyword.operator.arithmetic.js" @@ -2931,6 +2911,29 @@ } ] }, + "type-arguments": { + "name": "meta.type.parameters.js", + "begin": "\\<", + "beginCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.begin.js" + } + }, + "end": "\\>", + "endCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.end.js" + } + }, + "patterns": [ + { + "include": "#type" + }, + { + "include": "#punctuation-comma" + } + ] + }, "type": { "patterns": [ { @@ -3415,7 +3418,7 @@ }, { "name": "string.regexp.js", - "begin": "(?:*]|&&|\\|\\||\\?|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^)\\s*\n (?=(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?))", - "end": "(?!\\s*(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?))", + "begin": "(?<=[({\\[,?=>:*]|&&|\\|\\||\\?|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^)\\s*(?=(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?))", + "end": "(?!(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?))", "patterns": [ { "include": "#jsx-tag-without-attributes" @@ -4198,69 +4201,8 @@ ] }, "jsx-tag-in-expression": { - "begin": "(?x)\n (?<=[({\\[,?=>:*]|&&|\\|\\||\\?|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^)\\s*\n (?!<\\s*[_$[:alpha:]][_$[:alnum:]]*((\\s+extends\\s+[^=>])|,)) # look ahead is not type parameter of arrow\n (?=(<)\\s*\n ([_$a-zA-Z][-$\\w.]*(?))", - "end": "(/>)|(?:())", - "endCaptures": { - "0": { - "name": "meta.tag.js" - }, - "1": { - "name": "punctuation.definition.tag.end.js" - }, - "2": { - "name": "punctuation.definition.tag.begin.js" - }, - "3": { - "name": "entity.name.tag.namespace.js" - }, - "4": { - "name": "punctuation.separator.namespace.js" - }, - "5": { - "name": "entity.name.tag.js" - }, - "6": { - "name": "support.class.component.js" - }, - "7": { - "name": "punctuation.definition.tag.end.js" - } - }, - "patterns": [ - { - "include": "#jsx-tag" - } - ] - }, - "jsx-child-tag": { - "begin": "(?x)\n (?=(<)\\s*\n ([_$a-zA-Z][-$\\w.]*(?))", - "end": "(/>)|(?:())", - "endCaptures": { - "0": { - "name": "meta.tag.js" - }, - "1": { - "name": "punctuation.definition.tag.end.js" - }, - "2": { - "name": "punctuation.definition.tag.begin.js" - }, - "3": { - "name": "entity.name.tag.namespace.js" - }, - "4": { - "name": "punctuation.separator.namespace.js" - }, - "5": { - "name": "entity.name.tag.js" - }, - "6": { - "name": "support.class.component.js" - }, - "7": { - "name": "punctuation.definition.tag.end.js" - } - }, + "begin": "(?x)\n (?<=[({\\[,?=>:*]|&&|\\|\\||\\?|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^)\\s*\n (?!<\\s*[_$[:alpha:]][_$[:alnum:]]*((\\s+extends\\s+[^=>])|,)) # look ahead is not type parameter of arrow\n (?=(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>)?\\s+(?!\\?)|\\/?>))", + "end": "(?!(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>)?\\s+(?!\\?)|\\/?>))", "patterns": [ { "include": "#jsx-tag" @@ -4269,11 +4211,34 @@ }, "jsx-tag": { "name": "meta.tag.js", - "begin": "(?x)\n (?=(<)\\s*\n (?:([_$a-zA-Z][-$\\w.]*)(?))", - "end": "(?=(/>)|(?:()))", + "begin": "(?=(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>)?\\s+(?!\\?)|\\/?>))", + "end": "(/>)|(?:())", + "endCaptures": { + "1": { + "name": "punctuation.definition.tag.end.js" + }, + "2": { + "name": "punctuation.definition.tag.begin.js" + }, + "3": { + "name": "entity.name.tag.namespace.js" + }, + "4": { + "name": "punctuation.separator.namespace.js" + }, + "5": { + "name": "entity.name.tag.js" + }, + "6": { + "name": "support.class.component.js" + }, + "7": { + "name": "punctuation.definition.tag.end.js" + } + }, "patterns": [ { - "begin": "(?x)\n (<)\\s*\n (?:([_$a-zA-Z][-$\\w.]*)(?)", + "begin": "(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>)?\\s+(?!\\?)|\\/?>)", "beginCaptures": { "1": { "name": "punctuation.definition.tag.begin.js" @@ -4292,16 +4257,15 @@ } }, "end": "(?=[/]?>)", - "contentName": "meta.tag.attributes.js", "patterns": [ { "include": "#comment" }, { - "include": "#jsx-tag-attributes" + "include": "#type-arguments" }, { - "include": "#jsx-tag-attributes-illegal" + "include": "#jsx-tag-attributes" } ] }, @@ -4328,7 +4292,7 @@ "include": "#jsx-tag-without-attributes" }, { - "include": "#jsx-child-tag" + "include": "#jsx-tag" }, { "include": "#jsx-evaluated-code" @@ -4379,6 +4343,9 @@ ] }, "jsx-tag-attributes": { + "name": "meta.tag.attributes.js", + "begin": "\\s+", + "end": "(?=[/]?>)", "patterns": [ { "include": "#jsx-tag-attribute-name" @@ -4394,6 +4361,9 @@ }, { "include": "#jsx-evaluated-code" + }, + { + "include": "#jsx-tag-attributes-illegal" } ] }, diff --git a/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json b/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json index 3b012438e53..2de744ba7ed 100644 --- a/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json +++ b/extensions/javascript/syntaxes/JavaScriptReact.tmLanguage.json @@ -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/a7080b7f47b21f898d731feefb89813f66d00426", + "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/874564b73c579ea678697492f26dd925a3ce738f", "name": "JavaScript (with React support)", "scopeName": "source.js.jsx", "patterns": [ @@ -2137,27 +2137,7 @@ "match": "\\?\\." }, { - "name": "meta.type.parameters.js.jsx", - "begin": "\\<", - "beginCaptures": { - "0": { - "name": "punctuation.definition.typeparameters.begin.js.jsx" - } - }, - "end": "\\>", - "endCaptures": { - "0": { - "name": "punctuation.definition.typeparameters.end.js.jsx" - } - }, - "patterns": [ - { - "include": "#type" - }, - { - "include": "#punctuation-comma" - } - ] + "include": "#type-arguments" }, { "include": "#paren-expression" @@ -2354,7 +2334,7 @@ "match": "%|\\*|/|-|\\+" }, { - "match": "(?<=[_$[:alnum:])])\\s*(/)(?![/*])", + "match": "(?<=[_$[:alnum:])\\]])\\s*(/)(?![/*])", "captures": { "1": { "name": "keyword.operator.arithmetic.js.jsx" @@ -2931,6 +2911,29 @@ } ] }, + "type-arguments": { + "name": "meta.type.parameters.js.jsx", + "begin": "\\<", + "beginCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.begin.js.jsx" + } + }, + "end": "\\>", + "endCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.end.js.jsx" + } + }, + "patterns": [ + { + "include": "#type" + }, + { + "include": "#punctuation-comma" + } + ] + }, "type": { "patterns": [ { @@ -3415,7 +3418,7 @@ }, { "name": "string.regexp.js.jsx", - "begin": "(?:*]|&&|\\|\\||\\?|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^)\\s*\n (?=(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?))", - "end": "(?!\\s*(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?))", + "begin": "(?<=[({\\[,?=>:*]|&&|\\|\\||\\?|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^)\\s*(?=(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?))", + "end": "(?!(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?))", "patterns": [ { "include": "#jsx-tag-without-attributes" @@ -4198,69 +4201,8 @@ ] }, "jsx-tag-in-expression": { - "begin": "(?x)\n (?<=[({\\[,?=>:*]|&&|\\|\\||\\?|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^)\\s*\n (?!<\\s*[_$[:alpha:]][_$[:alnum:]]*((\\s+extends\\s+[^=>])|,)) # look ahead is not type parameter of arrow\n (?=(<)\\s*\n ([_$a-zA-Z][-$\\w.]*(?))", - "end": "(/>)|(?:())", - "endCaptures": { - "0": { - "name": "meta.tag.js.jsx" - }, - "1": { - "name": "punctuation.definition.tag.end.js.jsx" - }, - "2": { - "name": "punctuation.definition.tag.begin.js.jsx" - }, - "3": { - "name": "entity.name.tag.namespace.js.jsx" - }, - "4": { - "name": "punctuation.separator.namespace.js.jsx" - }, - "5": { - "name": "entity.name.tag.js.jsx" - }, - "6": { - "name": "support.class.component.js.jsx" - }, - "7": { - "name": "punctuation.definition.tag.end.js.jsx" - } - }, - "patterns": [ - { - "include": "#jsx-tag" - } - ] - }, - "jsx-child-tag": { - "begin": "(?x)\n (?=(<)\\s*\n ([_$a-zA-Z][-$\\w.]*(?))", - "end": "(/>)|(?:())", - "endCaptures": { - "0": { - "name": "meta.tag.js.jsx" - }, - "1": { - "name": "punctuation.definition.tag.end.js.jsx" - }, - "2": { - "name": "punctuation.definition.tag.begin.js.jsx" - }, - "3": { - "name": "entity.name.tag.namespace.js.jsx" - }, - "4": { - "name": "punctuation.separator.namespace.js.jsx" - }, - "5": { - "name": "entity.name.tag.js.jsx" - }, - "6": { - "name": "support.class.component.js.jsx" - }, - "7": { - "name": "punctuation.definition.tag.end.js.jsx" - } - }, + "begin": "(?x)\n (?<=[({\\[,?=>:*]|&&|\\|\\||\\?|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^)\\s*\n (?!<\\s*[_$[:alpha:]][_$[:alnum:]]*((\\s+extends\\s+[^=>])|,)) # look ahead is not type parameter of arrow\n (?=(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>)?\\s+(?!\\?)|\\/?>))", + "end": "(?!(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>)?\\s+(?!\\?)|\\/?>))", "patterns": [ { "include": "#jsx-tag" @@ -4269,11 +4211,34 @@ }, "jsx-tag": { "name": "meta.tag.js.jsx", - "begin": "(?x)\n (?=(<)\\s*\n (?:([_$a-zA-Z][-$\\w.]*)(?))", - "end": "(?=(/>)|(?:()))", + "begin": "(?=(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>)?\\s+(?!\\?)|\\/?>))", + "end": "(/>)|(?:())", + "endCaptures": { + "1": { + "name": "punctuation.definition.tag.end.js.jsx" + }, + "2": { + "name": "punctuation.definition.tag.begin.js.jsx" + }, + "3": { + "name": "entity.name.tag.namespace.js.jsx" + }, + "4": { + "name": "punctuation.separator.namespace.js.jsx" + }, + "5": { + "name": "entity.name.tag.js.jsx" + }, + "6": { + "name": "support.class.component.js.jsx" + }, + "7": { + "name": "punctuation.definition.tag.end.js.jsx" + } + }, "patterns": [ { - "begin": "(?x)\n (<)\\s*\n (?:([_$a-zA-Z][-$\\w.]*)(?)", + "begin": "(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>)?\\s+(?!\\?)|\\/?>)", "beginCaptures": { "1": { "name": "punctuation.definition.tag.begin.js.jsx" @@ -4292,16 +4257,15 @@ } }, "end": "(?=[/]?>)", - "contentName": "meta.tag.attributes.js.jsx", "patterns": [ { "include": "#comment" }, { - "include": "#jsx-tag-attributes" + "include": "#type-arguments" }, { - "include": "#jsx-tag-attributes-illegal" + "include": "#jsx-tag-attributes" } ] }, @@ -4328,7 +4292,7 @@ "include": "#jsx-tag-without-attributes" }, { - "include": "#jsx-child-tag" + "include": "#jsx-tag" }, { "include": "#jsx-evaluated-code" @@ -4379,6 +4343,9 @@ ] }, "jsx-tag-attributes": { + "name": "meta.tag.attributes.js.jsx", + "begin": "\\s+", + "end": "(?=[/]?>)", "patterns": [ { "include": "#jsx-tag-attribute-name" @@ -4394,6 +4361,9 @@ }, { "include": "#jsx-evaluated-code" + }, + { + "include": "#jsx-tag-attributes-illegal" } ] }, diff --git a/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json b/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json index abbf17da3ec..1ea549e6d15 100644 --- a/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json +++ b/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json @@ -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/a7080b7f47b21f898d731feefb89813f66d00426", + "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/aef7be5c6dafd9f703a59aebd378da97acdf1023", "name": "TypeScript", "scopeName": "source.ts", "patterns": [ @@ -2134,27 +2134,7 @@ "match": "\\?\\." }, { - "name": "meta.type.parameters.ts", - "begin": "\\<", - "beginCaptures": { - "0": { - "name": "punctuation.definition.typeparameters.begin.ts" - } - }, - "end": "\\>", - "endCaptures": { - "0": { - "name": "punctuation.definition.typeparameters.end.ts" - } - }, - "patterns": [ - { - "include": "#type" - }, - { - "include": "#punctuation-comma" - } - ] + "include": "#type-arguments" }, { "include": "#paren-expression" @@ -2388,7 +2368,7 @@ "match": "%|\\*|/|-|\\+" }, { - "match": "(?<=[_$[:alnum:])])\\s*(/)(?![/*])", + "match": "(?<=[_$[:alnum:])\\]])\\s*(/)(?![/*])", "captures": { "1": { "name": "keyword.operator.arithmetic.ts" @@ -2965,6 +2945,29 @@ } ] }, + "type-arguments": { + "name": "meta.type.parameters.ts", + "begin": "\\<", + "beginCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.begin.ts" + } + }, + "end": "\\>", + "endCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.end.ts" + } + }, + "patterns": [ + { + "include": "#type" + }, + { + "include": "#punctuation-comma" + } + ] + }, "type": { "patterns": [ { @@ -3449,7 +3452,7 @@ }, { "name": "string.regexp.ts", - "begin": "(?", - "endCaptures": { - "0": { - "name": "punctuation.definition.typeparameters.end.tsx" - } - }, - "patterns": [ - { - "include": "#type" - }, - { - "include": "#punctuation-comma" - } - ] + "include": "#type-arguments" }, { "include": "#paren-expression" @@ -2354,7 +2334,7 @@ "match": "%|\\*|/|-|\\+" }, { - "match": "(?<=[_$[:alnum:])])\\s*(/)(?![/*])", + "match": "(?<=[_$[:alnum:])\\]])\\s*(/)(?![/*])", "captures": { "1": { "name": "keyword.operator.arithmetic.tsx" @@ -2931,6 +2911,29 @@ } ] }, + "type-arguments": { + "name": "meta.type.parameters.tsx", + "begin": "\\<", + "beginCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.begin.tsx" + } + }, + "end": "\\>", + "endCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.end.tsx" + } + }, + "patterns": [ + { + "include": "#type" + }, + { + "include": "#punctuation-comma" + } + ] + }, "type": { "patterns": [ { @@ -3415,7 +3418,7 @@ }, { "name": "string.regexp.tsx", - "begin": "(?:*]|&&|\\|\\||\\?|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^)\\s*\n (?=(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?))", - "end": "(?!\\s*(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?))", + "begin": "(?<=[({\\[,?=>:*]|&&|\\|\\||\\?|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^)\\s*(?=(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?))", + "end": "(?!(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?))", "patterns": [ { "include": "#jsx-tag-without-attributes" @@ -4198,69 +4201,8 @@ ] }, "jsx-tag-in-expression": { - "begin": "(?x)\n (?<=[({\\[,?=>:*]|&&|\\|\\||\\?|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^)\\s*\n (?!<\\s*[_$[:alpha:]][_$[:alnum:]]*((\\s+extends\\s+[^=>])|,)) # look ahead is not type parameter of arrow\n (?=(<)\\s*\n ([_$a-zA-Z][-$\\w.]*(?))", - "end": "(/>)|(?:())", - "endCaptures": { - "0": { - "name": "meta.tag.tsx" - }, - "1": { - "name": "punctuation.definition.tag.end.tsx" - }, - "2": { - "name": "punctuation.definition.tag.begin.tsx" - }, - "3": { - "name": "entity.name.tag.namespace.tsx" - }, - "4": { - "name": "punctuation.separator.namespace.tsx" - }, - "5": { - "name": "entity.name.tag.tsx" - }, - "6": { - "name": "support.class.component.tsx" - }, - "7": { - "name": "punctuation.definition.tag.end.tsx" - } - }, - "patterns": [ - { - "include": "#jsx-tag" - } - ] - }, - "jsx-child-tag": { - "begin": "(?x)\n (?=(<)\\s*\n ([_$a-zA-Z][-$\\w.]*(?))", - "end": "(/>)|(?:())", - "endCaptures": { - "0": { - "name": "meta.tag.tsx" - }, - "1": { - "name": "punctuation.definition.tag.end.tsx" - }, - "2": { - "name": "punctuation.definition.tag.begin.tsx" - }, - "3": { - "name": "entity.name.tag.namespace.tsx" - }, - "4": { - "name": "punctuation.separator.namespace.tsx" - }, - "5": { - "name": "entity.name.tag.tsx" - }, - "6": { - "name": "support.class.component.tsx" - }, - "7": { - "name": "punctuation.definition.tag.end.tsx" - } - }, + "begin": "(?x)\n (?<=[({\\[,?=>:*]|&&|\\|\\||\\?|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^)\\s*\n (?!<\\s*[_$[:alpha:]][_$[:alnum:]]*((\\s+extends\\s+[^=>])|,)) # look ahead is not type parameter of arrow\n (?=(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>)?\\s+(?!\\?)|\\/?>))", + "end": "(?!(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>)?\\s+(?!\\?)|\\/?>))", "patterns": [ { "include": "#jsx-tag" @@ -4269,11 +4211,34 @@ }, "jsx-tag": { "name": "meta.tag.tsx", - "begin": "(?x)\n (?=(<)\\s*\n (?:([_$a-zA-Z][-$\\w.]*)(?))", - "end": "(?=(/>)|(?:()))", + "begin": "(?=(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>)?\\s+(?!\\?)|\\/?>))", + "end": "(/>)|(?:())", + "endCaptures": { + "1": { + "name": "punctuation.definition.tag.end.tsx" + }, + "2": { + "name": "punctuation.definition.tag.begin.tsx" + }, + "3": { + "name": "entity.name.tag.namespace.tsx" + }, + "4": { + "name": "punctuation.separator.namespace.tsx" + }, + "5": { + "name": "entity.name.tag.tsx" + }, + "6": { + "name": "support.class.component.tsx" + }, + "7": { + "name": "punctuation.definition.tag.end.tsx" + } + }, "patterns": [ { - "begin": "(?x)\n (<)\\s*\n (?:([_$a-zA-Z][-$\\w.]*)(?)", + "begin": "(<)\\s*(?:([_$a-zA-Z][-$\\w.]*)(?\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>|\\<\\s*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{[^\\{\\}]*\\}))*\\})|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(\\[([^\\[\\]]|(\\[[^\\[\\]]*\\]))*\\]))|(\\'[^\\']*\\')|(\\\"[^\\\"]*\\\")|(\\`[^\\`]*\\`))([^<>\\(]|(\\(([^\\(\\)]|(\\([^\\(\\)]*\\)))*\\))|(?<==)\\>)*(?!=)\\>)*(?!=)>)?\\s+(?!\\?)|\\/?>)", "beginCaptures": { "1": { "name": "punctuation.definition.tag.begin.tsx" @@ -4292,16 +4257,15 @@ } }, "end": "(?=[/]?>)", - "contentName": "meta.tag.attributes.tsx", "patterns": [ { "include": "#comment" }, { - "include": "#jsx-tag-attributes" + "include": "#type-arguments" }, { - "include": "#jsx-tag-attributes-illegal" + "include": "#jsx-tag-attributes" } ] }, @@ -4328,7 +4292,7 @@ "include": "#jsx-tag-without-attributes" }, { - "include": "#jsx-child-tag" + "include": "#jsx-tag" }, { "include": "#jsx-evaluated-code" @@ -4379,6 +4343,9 @@ ] }, "jsx-tag-attributes": { + "name": "meta.tag.attributes.tsx", + "begin": "\\s+", + "end": "(?=[/]?>)", "patterns": [ { "include": "#jsx-tag-attribute-name" @@ -4394,6 +4361,9 @@ }, { "include": "#jsx-evaluated-code" + }, + { + "include": "#jsx-tag-attributes-illegal" } ] },