{ "name": "TypeScriptReact", "scopeName": "source.tsx", "fileTypes": [ "tsx" ], "uuid": "805375ec-d614-41f5-8993-5843fe63ea82", "patterns": [ { "include": "#statements" } ], "repository": { "statements": { "patterns": [ { "include": "#string" }, { "include": "#regex" }, { "include": "#template" }, { "include": "#comment" }, { "include": "#literal" }, { "include": "#declaration" }, { "include": "#switch-statement" }, { "include": "#for-loop" }, { "include": "#after-operator-block" }, { "include": "#decl-block" }, { "include": "#control-statement" }, { "include": "#expression" }, { "include": "#punctuation-semicolon" } ] }, "var-expr": { "name": "meta.var.expr.tsx", "begin": "(?])|(?<=[\\}>\\]\\)]|[_$[:alpha:]])\\s*(?=\\{)", "patterns": [ { "include": "#comment" }, { "include": "#type" } ] }, "type": { "name": "meta.type.tsx", "patterns": [ { "include": "#comment" }, { "include": "#string" }, { "include": "#numeric-literal" }, { "include": "#type-primitive" }, { "include": "#type-builtin-literals" }, { "include": "#type-parameters" }, { "include": "#type-tuple" }, { "include": "#type-object" }, { "include": "#type-operators" }, { "include": "#type-fn-type-parameters" }, { "include": "#type-paren-or-function-parameters" }, { "include": "#type-function-return-type" }, { "include": "#type-name" } ] }, "function-parameters": { "name": "meta.parameters.tsx", "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.parameters.begin.tsx" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.parameters.end.tsx" } }, "patterns": [ { "include": "#comment" }, { "include": "#decorator" }, { "include": "#destructuring-parameter" }, { "include": "#parameter-name" }, { "include": "#type-annotation" }, { "include": "#variable-initializer" }, { "name": "punctuation.separator.parameter.tsx", "match": "," } ] }, "type-primitive": { "name": "support.type.primitive.tsx", "match": "(?)\\s*(?=\\()", "end": "(?<=\\))", "patterns": [ { "include": "#function-parameters" } ] }, { "name": "meta.type.function.tsx", "begin": "(?x)( \\s* (?= [(]\\s*( ([)]) | (\\.\\.\\.) | ([_$[:alnum:]]+\\s*( ([:,?=])| ([)]\\s*=>) )) ) ) )", "end": "(?<=\\))", "patterns": [ { "include": "#function-parameters" } ] } ] }, "type-operators": { "patterns": [ { "include": "#typeof-operator" }, { "name": "keyword.operator.type.tsx", "match": "[&|]" } ] }, "type-function-return-type": { "name": "meta.type.function.return.tsx", "begin": "=>", "beginCaptures": { "0": { "name": "storage.type.function.arrow.tsx" } }, "end": "(?)(?=[,\\]\\)\\{\\}=;>]|//|$)", "patterns": [ { "include": "#comment" }, { "name": "meta.object.type.tsx", "begin": "(?<==>)\\s*(\\{)", "beginCaptures": { "1": { "name": "punctuation.definition.block.tsx" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.block.tsx" } }, "patterns": [ { "include": "#type-object-members" } ] }, { "include": "#type-predicate-operator" }, { "include": "#type" } ] }, "type-tuple": { "name": "meta.type.tuple.tsx", "begin": "\\[", "beginCaptures": { "0": { "name": "meta.brace.square.tsx" } }, "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.tsx" } }, "patterns": [ { "include": "#type" }, { "include": "#punctuation-comma" } ] }, "type-name": { "patterns": [ { "match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(\\.)", "captures": { "1": { "name": "entity.name.type.module.tsx" }, "2": { "name": "punctuation.accessor.tsx" } } }, { "name": "entity.name.type.tsx", "match": "[_$[:alpha:]][_$[:alnum:]]*" } ] }, "type-parameters": { "name": "meta.type.parameters.tsx", "begin": "(<)", "beginCaptures": { "1": { "name": "punctuation.definition.typeparameters.begin.tsx" } }, "end": "(?=$)|(>)", "endCaptures": { "1": { "name": "punctuation.definition.typeparameters.end.tsx" } }, "patterns": [ { "include": "#comment" }, { "name": "storage.modifier.tsx", "match": "(?]|\\<[^<>]+\\>)+>\\s*)?\\()", "captures": { "1": { "name": "punctuation.accessor.tsx" }, "2": { "name": "support.constant.dom.tsx" }, "3": { "name": "support.variable.property.dom.tsx" } } }, { "name": "support.class.node.tsx", "match": "(?x)(?]|\\<[^<>]+\\>)+>\\s*)?\\()", "beginCaptures": { "1": { "name": "punctuation.accessor.tsx" }, "2": { "name": "entity.name.function.tsx" } }, "end": "(?<=\\))", "patterns": [ { "include": "#comment" }, { "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" } ] }, { "include": "#paren-expression" } ] }, "identifiers": { "patterns": [ { "name": "support.class.tsx", "match": "([_$[:alpha:]][_$[:alnum:]]*)(?=\\s*\\.\\s*prototype\\b(?!\\$))" }, { "match": "(?x)(\\.)\\s*(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "punctuation.accessor.tsx" }, "2": { "name": "constant.other.object.property.tsx" }, "3": { "name": "variable.other.object.property.tsx" } } }, { "match": "(?x)(?:(\\.)\\s*)?([_$[:alpha:]][_$[:alnum:]]*)(?=\\s*=\\s*( (async\\s+)|(function\\s+)| ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)| ((<([^<>]|\\<[^<>]+\\>)+>\\s*)?\\(([^()]|\\([^()]*\\))*\\)(\\s*:\\s*(.)*)?\\s*=>)))", "captures": { "1": { "name": "punctuation.accessor.tsx" }, "2": { "name": "entity.name.function.tsx" } } }, { "match": "(\\.)\\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])", "captures": { "1": { "name": "punctuation.accessor.tsx" }, "2": { "name": "constant.other.property.tsx" } } }, { "match": "(\\.)\\s*([_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "punctuation.accessor.tsx" }, "2": { "name": "variable.other.property.tsx" } } }, { "match": "(?x)(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\.\\s*[_$[:alpha:]][_$[:alnum:]]*)", "captures": { "1": { "name": "constant.other.object.tsx" }, "2": { "name": "variable.other.object.tsx" } } }, { "name": "constant.other.tsx", "match": "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])" }, { "name": "variable.other.readwrite.tsx", "match": "[_$[:alpha:]][_$[:alnum:]]*" } ] }, "cast": { "patterns": [ { "include": "#jsx" } ] }, "new-expr": { "name": "new.expr.tsx", "begin": "(?)| ((<([^<>]|\\<[^<>]+\\>)+>\\s*)?\\(([^()]|\\([^()]*\\))*\\)(\\s*:\\s*(.)*)?\\s*=>))))", "beginCaptures": { "0": { "name": "meta.object-literal.key.tsx" }, "1": { "name": "entity.name.function.tsx" }, "2": { "name": "punctuation.separator.key-value.tsx" } }, "end": "(?=,|\\})", "patterns": [ { "include": "#expression" } ] }, { "name": "meta.object.member.tsx", "begin": "(?:[_$[:alpha:]][_$[:alnum:]]*)\\s*(:)", "beginCaptures": { "0": { "name": "meta.object-literal.key.tsx" }, "1": { "name": "punctuation.separator.key-value.tsx" } }, "end": "(?=,|\\})", "patterns": [ { "include": "#expression" } ] }, { "name": "meta.object.member.tsx", "begin": "\\.\\.\\.", "beginCaptures": { "0": { "name": "keyword.operator.spread.tsx" } }, "end": "(?=,|\\})", "patterns": [ { "include": "#expression" } ] }, { "name": "meta.object.member.tsx", "match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=,|\\}|$)", "captures": { "1": { "name": "variable.other.readwrite.tsx" } } }, { "include": "#punctuation-comma" } ] }, "expression-operators": { "patterns": [ { "name": "keyword.control.flow.tsx", "match": "(?>=|>>>=|\\|=" }, { "name": "keyword.operator.bitwise.shift.tsx", "match": "<<|>>>|>>" }, { "name": "keyword.operator.comparison.tsx", "match": "===|!==|==|!=" }, { "name": "keyword.operator.relational.tsx", "match": "<=|>=|<>|<|>" }, { "name": "keyword.operator.logical.tsx", "match": "\\!|&&|\\|\\|" }, { "name": "keyword.operator.bitwise.tsx", "match": "\\&|~|\\^|\\|" }, { "name": "keyword.operator.assignment.tsx", "match": "\\=" }, { "name": "keyword.operator.decrement.tsx", "match": "--" }, { "name": "keyword.operator.increment.tsx", "match": "\\+\\+" }, { "name": "keyword.operator.arithmetic.tsx", "match": "%|\\*|/|-|\\+" } ] }, "typeof-operator": { "name": "keyword.operator.expression.typeof.tsx", "match": "(?)", "captures": { "1": { "name": "storage.modifier.async.tsx" }, "2": { "name": "variable.parameter.tsx" } } }, { "name": "meta.arrow.tsx", "begin": "(?x)\\s*(?=(<([^<>]|\\<[^<>]+\\>)+>\\s*)?\\(([^()]|\\([^()]*\\))*\\)(\\s*:\\s*(.)*)?\\s*=>)", "end": "(?==>)", "patterns": [ { "include": "#comment" }, { "include": "#type-parameters" }, { "include": "#function-parameters" }, { "include": "#arrow-return-type" } ] }, { "name": "meta.arrow.tsx", "begin": "=>", "beginCaptures": { "0": { "name": "storage.type.function.arrow.tsx" } }, "end": "(?<=\\})|((?!\\{)(?=\\S))", "patterns": [ { "include": "#decl-block" }, { "include": "#expression" } ] } ] }, "arrow-return-type": { "name": "meta.return.type.arrow.tsx", "begin": "(?<=\\))\\s*(:)", "beginCaptures": { "1": { "name": "keyword.operator.type.annotation.tsx" } }, "end": "(?|;|//))", "patterns": [ { "include": "#type-predicate-operator" }, { "include": "#type" } ] }, "punctuation-comma": { "name": "punctuation.separator.comma.tsx", "match": "," }, "punctuation-semicolon": { "name": "punctuation.terminator.statement.tsx", "match": ";" }, "punctuation-accessor": { "name": "punctuation.accessor.tsx", "match": "\\." }, "paren-expression": { "begin": "\\(", "beginCaptures": { "0": { "name": "meta.brace.round.tsx" } }, "end": "\\)", "endCaptures": { "0": { "name": "meta.brace.round.tsx" } }, "patterns": [ { "include": "#expression" }, { "include": "#punctuation-comma" } ] }, "qstring-double": { "name": "string.quoted.double.tsx", "begin": "\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.tsx" } }, "end": "(\")|((?:[^\\\\\\n])$)", "endCaptures": { "1": { "name": "punctuation.definition.string.end.tsx" }, "2": { "name": "invalid.illegal.newline.tsx" } }, "patterns": [ { "include": "#string-character-escape" } ] }, "qstring-single": { "name": "string.quoted.single.tsx", "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.tsx" } }, "end": "(\\')|((?:[^\\\\\\n])$)", "endCaptures": { "1": { "name": "punctuation.definition.string.end.tsx" }, "2": { "name": "invalid.illegal.newline.tsx" } }, "patterns": [ { "include": "#string-character-escape" } ] }, "regex": { "patterns": [ { "name": "string.regex.tsx", "begin": "(?<=[=(:,\\[?+!]|return|case|=>|&&|\\|\\||\\*\\/)\\s*(/)(?![/*+?])(?=.*/)", "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.tsx" } }, "end": "(/)([gimuy]*)", "endCaptures": { "1": { "name": "punctuation.definition.string.end.tsx" }, "2": { "name": "keyword.other.tsx" } }, "patterns": [ { "include": "#regexp" } ] }, { "name": "string.regex.tsx", "begin": "/(?![/*])(?=(?:[^/\\\\\\[]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\])+/(?![/*])[gimy]*(?!\\s*[a-zA-Z0-9_$]))", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.tsx" } }, "end": "(/)([gimuy]*)", "endCaptures": { "1": { "name": "punctuation.definition.string.end.tsx" }, "2": { "name": "keyword.other.tsx" } }, "patterns": [ { "include": "#regexp" } ] } ] }, "regexp": { "patterns": [ { "name": "keyword.control.anchor.regexp", "match": "\\\\[bB]|\\^|\\$" }, { "name": "keyword.other.back-reference.regexp", "match": "\\\\[1-9]\\d*" }, { "name": "keyword.operator.quantifier.regexp", "match": "[?+*]|\\{(\\d+,\\d+|\\d+,|,\\d+|\\d+)\\}\\??" }, { "name": "keyword.operator.or.regexp", "match": "\\|" }, { "name": "meta.group.assertion.regexp", "begin": "(\\()((\\?=)|(\\?!))", "beginCaptures": { "1": { "name": "punctuation.definition.group.regexp" }, "2": { "name": "punctuation.definition.group.assertion.regexp" }, "3": { "name": "meta.assertion.look-ahead.regexp" }, "4": { "name": "meta.assertion.negative-look-ahead.regexp" } }, "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.definition.group.regexp" } }, "patterns": [ { "include": "#regexp" } ] }, { "name": "meta.group.regexp", "begin": "\\((\\?:)?", "beginCaptures": { "0": { "name": "punctuation.definition.group.regexp" }, "1": { "name": "punctuation.definition.group.capture.regexp" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.group.regexp" } }, "patterns": [ { "include": "#regexp" } ] }, { "name": "constant.other.character-class.set.regexp", "begin": "(\\[)(\\^)?", "beginCaptures": { "1": { "name": "punctuation.definition.character-class.regexp" }, "2": { "name": "keyword.operator.negation.regexp" } }, "end": "(\\])", "endCaptures": { "1": { "name": "punctuation.definition.character-class.regexp" } }, "patterns": [ { "name": "constant.other.character-class.range.regexp", "match": "(?:.|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))", "captures": { "1": { "name": "constant.character.numeric.regexp" }, "2": { "name": "constant.character.control.regexp" }, "3": { "name": "constant.character.escape.backslash.regexp" }, "4": { "name": "constant.character.numeric.regexp" }, "5": { "name": "constant.character.control.regexp" }, "6": { "name": "constant.character.escape.backslash.regexp" } } }, { "include": "#regex-character-class" } ] }, { "include": "#regex-character-class" } ] }, "regex-character-class": { "patterns": [ { "name": "constant.other.character-class.regexp", "match": "\\\\[wWsSdDtrnvf]|\\." }, { "name": "constant.character.numeric.regexp", "match": "\\\\([0-7]{3}|x\\h\\h|u\\h\\h\\h\\h)" }, { "name": "constant.character.control.regexp", "match": "\\\\c[A-Z]" }, { "name": "constant.character.escape.backslash.regexp", "match": "\\\\." } ] }, "string": { "name": "string.tsx", "patterns": [ { "include": "#qstring-single" }, { "include": "#qstring-double" } ] }, "template": { "name": "string.template.tsx", "begin": "([_$[:alpha:]][_$[:alnum:]]*)?(`)", "beginCaptures": { "1": { "name": "entity.name.function.tagged-template.tsx" }, "2": { "name": "punctuation.definition.string.template.begin.tsx" } }, "end": "`", "endCaptures": { "0": { "name": "punctuation.definition.string.template.end.tsx" } }, "patterns": [ { "include": "#template-substitution-element" }, { "include": "#string-character-escape" } ] }, "string-character-escape": { "name": "constant.character.escape.tsx", "match": "\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)" }, "template-substitution-element": { "name": "meta.template.expression.tsx", "begin": "\\$\\{", "beginCaptures": { "0": { "name": "punctuation.definition.template-expression.begin.tsx" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.template-expression.end.tsx" } }, "patterns": [ { "include": "#expression" } ] }, "literal": { "name": "literal.tsx", "patterns": [ { "include": "#numeric-literal" }, { "include": "#boolean-literal" }, { "include": "#null-literal" }, { "include": "#undefined-literal" }, { "include": "#numericConstant-literal" }, { "include": "#array-literal" }, { "include": "#this-literal" }, { "include": "#super-literal" } ] }, "array-literal": { "name": "meta.array.literal.tsx", "begin": "\\[", "beginCaptures": { "0": { "name": "meta.brace.square.tsx" } }, "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.tsx" } }, "patterns": [ { "include": "#expression" }, { "include": "#punctuation-comma" } ] }, "numeric-literal": { "patterns": [ { "name": "constant.numeric.hex.tsx", "match": "\\b(? # {Array} or {Object} type application (optional .)\n )\n (?:\n [\\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback\n [a-zA-Z_$]+\n (?:\n (?:\n [\\w$]*\n (?:\\[\\])? # {(string|number[])} type application, a string or an array of numbers\n ) |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n )*\n \\) |\n [a-zA-Z_$]+\n (?:\n (?:\n [\\w$]*\n (?:\\[\\])? # {string[]|number} type application, an array of strings or a number\n ) |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n (?:\n [\\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n )*\n )\n # Check for suffix\n (?:\\[\\])? # {string[]} type application, an array of strings\n =? # {string=} optional parameter\n)})\n\\s+\n(\n \\[ # [foo] optional parameter\n \\s*\n (?:\n [a-zA-Z_$][\\w$]*\n (?:\n (?:\\[\\])? # Foo[].bar properties within an array\n \\. # Foo.Bar namespaced parameter\n [a-zA-Z_$][\\w$]*\n )*\n (?:\n \\s*\n = # [foo=bar] Default parameter value\n \\s*\n [\\w$\\s]*\n )?\n )\n \\s*\n \\] |\n (?:\n [a-zA-Z_$][\\w$]*\n (?:\n (?:\\[\\])? # Foo[].bar properties within an array\n \\. # Foo.Bar namespaced parameter\n [a-zA-Z_$][\\w$]*\n )*\n )?\n)\n\\s+\n(?:-\\s+)? # optional hyphen before the description\n((?:(?!\\*\\/).)*) # The type description", "captures": { "0": { "name": "other.meta.jsdoc" }, "1": { "name": "entity.name.type.instance.jsdoc" }, "2": { "name": "variable.other.jsdoc" }, "3": { "name": "other.description.jsdoc" } } }, { "match": "(?x)\n({(?:\n \\* | # {*} any type\n \\? | # {?} unknown type\n\n (?: # Check for a prefix\n \\? | # {?string} nullable type\n ! | # {!string} non-nullable type\n \\.{3} # {...string} variable number of parameters\n )?\n\n (?:\n \\( # Opening bracket of multiple types with parenthesis {(string|number)}\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n (?:\n [\\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n )*\n \\) |\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n (?:\n [\\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback\n [a-zA-Z_$]+\n (?:\n [\\w$]* |\n \\.?<[\\w$]+(?:,\\s+[\\w$]+)*> # {Array} or {Object} type application (optional .)\n )\n )*\n )\n # Check for suffix\n (?:\\[\\])? # {string[]} type application, an array of strings\n =? # {string=} optional parameter\n)})\n\\s+\n(?:-\\s+)? # optional hyphen before the description\n((?:(?!\\*\\/).)*) # The type description", "captures": { "0": { "name": "other.meta.jsdoc" }, "1": { "name": "entity.name.type.instance.jsdoc" }, "2": { "name": "other.description.jsdoc" } } } ] }, "jsx-tag-attributes": { "patterns": [ { "include": "#jsx-tag-attribute-name" }, { "include": "#jsx-tag-attribute-assignment" }, { "include": "#jsx-string-double-quoted" }, { "include": "#jsx-string-single-quoted" }, { "include": "#jsx-evaluated-code" } ] }, "jsx-tag-attribute-name": { "name": "meta.tag.attribute-name.tsx", "match": "(?x)\n \\s*\n ([_$a-zA-Z][-$\\w]*)\n (?=\\s|=|/?>|/\\*|//)", "captures": { "1": { "name": "entity.other.attribute-name.tsx" } } }, "jsx-tag-attribute-assignment": { "name": "keyword.operator.assignment.tsx", "match": "=(?=\\s*(?:'|\"|{|/\\*|//|\\n))" }, "jsx-string-double-quoted": { "name": "string.jsxAttributeValue.quoted.double.tsx", "begin": "\"", "end": "\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.jsxAttributeValue.begin.tsx" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.jsxAttributeValue.end.tsx" } }, "patterns": [ { "include": "#jsx-attributeValue-entities" } ] }, "jsx-string-single-quoted": { "name": "string.jsxAttributeValue.quoted.single.tsx", "begin": "'", "end": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.jsxAttributeValue.begin.tsx" } }, "endCaptures": { "0": { "name": "punctuation.definition.string.jsxAttributeValue.end.tsx" } }, "patterns": [ { "include": "#jsx-attributeValue-entities" } ] }, "jsx-entities": { "patterns": [ { "name": "constant.character.entity.tsx", "match": "(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)", "captures": { "1": { "name": "punctuation.definition.entity.tsx" }, "3": { "name": "punctuation.definition.entity.tsx" } } }, { "name": "invalid.illegal.bad-ampersand.tsx", "match": "&" } ] }, "jsx-attributeValue-entities": { "patterns": [ { "name": "constant.character.entity.jsxAttributeValue.tsx", "match": "(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)", "captures": { "1": { "name": "punctuation.definition.entity.jsxAttributeValue.tsx" }, "3": { "name": "punctuation.definition.entity.jsxAttributeValue.tsx" } } }, { "name": "invalid.illegal.bad-ampersand.jsxAttributeValue.tsx", "match": "&" } ] }, "jsx-evaluated-code": { "name": "meta.embedded.expression.tsx", "begin": "{", "end": "}", "beginCaptures": { "0": { "name": "punctuation.section.embedded.begin.tsx" } }, "endCaptures": { "0": { "name": "punctuation.section.embedded.end.tsx" } }, "patterns": [ { "include": "#expression" } ] }, "jsx-tag-attributes-illegal": { "name": "invalid.illegal.attribute.tsx", "match": "\\S+" }, "jsx-tag-without-attributes": { "name": "meta.tag.without-attributes.tsx", "begin": "(<)\\s*([_$a-zA-Z][-$\\w.]*(?)", "end": "()", "beginCaptures": { "1": { "name": "punctuation.definition.tag.begin.tsx" }, "2": { "name": "entity.name.tag.tsx" }, "3": { "name": "punctuation.definition.tag.end.tsx" } }, "endCaptures": { "1": { "name": "punctuation.definition.tag.begin.tsx" }, "2": { "name": "entity.name.tag.tsx" }, "3": { "name": "punctuation.definition.tag.end.tsx" } }, "contentName": "meta.jsx.children.tsx", "patterns": [ { "include": "#jsx-children" } ] }, "jsx-tag-in-expression": { "begin": "(?x)\n (?<=[({\\[,?=>]|&&|\\|\\||\\?|\\Wreturn|^return|\\Wdefault|^)\\s*\n (?!(<)\\s*([_$a-zA-Z][-$\\w.]*(?)) #look ahead is not start of tag without attributes\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.tsx" }, "4": { "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.tsx" }, "4": { "name": "punctuation.definition.tag.end.tsx" } }, "patterns": [ { "include": "#jsx-tag" } ] }, "jsx-tag": { "name": "meta.tag.tsx", "begin": "(?x)\n (?=(<)\\s*\n ([_$a-zA-Z][-$\\w.]*(?))", "end": "(?=(/>)|(?:()))", "patterns": [ { "begin": "(?x)\n (<)\\s*\n ([_$a-zA-Z][-$\\w.]*(?)", "beginCaptures": { "1": { "name": "punctuation.definition.tag.begin.tsx" }, "2": { "name": "entity.name.tag.tsx" } }, "end": "(?=[/]?>)", "patterns": [ { "include": "#comment" }, { "include": "#jsx-tag-attributes" }, { "include": "#jsx-tag-attributes-illegal" } ] }, { "begin": "(>)", "beginCaptures": { "1": { "name": "punctuation.definition.tag.end.tsx" } }, "end": "(?=" }, "jsx-children": { "patterns": [ { "include": "#jsx-tag-without-attributes" }, { "include": "#jsx-child-tag" }, { "include": "#jsx-tag-invalid" }, { "include": "#jsx-evaluated-code" }, { "include": "#jsx-entities" } ] }, "jsx": { "patterns": [ { "include": "#jsx-tag-without-attributes" }, { "include": "#jsx-tag-in-expression" }, { "include": "#jsx-tag-invalid" } ] } } }