{ "fileTypes": [ "tsx" ], "name": "TypeScriptReact", "patterns": [ { "include": "#expression" } ], "repository": { "access-modifier": { "match": "\\b(public|protected|private)\\b", "name": "storage.modifier.tsx" }, "arithmetic-operator": { "match": "\\*|/|\\-\\-|\\-|\\+\\+|\\+|%", "name": "keyword.operator.arithmetic.tsx" }, "array-literal": { "begin": "\\[", "beginCaptures": { "0": { "name": "meta.brace.square.tsx" } }, "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.tsx" } }, "name": "meta.array.literal.tsx", "patterns": [ { "include": "#expression" } ] }, "assignment-operator": { "match": "<<=|>>>=|>>=|\\*=|(?", "name": "keyword.operator.tsx" }, "import-operator": { "match": "\\b(import|from)\\b", "name": "keyword.control.import.include.tsx" }, "indexer-declaration": { "begin": "\\[", "beginCaptures": { "0": { "name": "meta.brace.square.tsx" } }, "end": "(\\])\\s*(\\?\\s*)?|$", "endCaptures": { "1": { "name": "meta.brace.square.tsx" }, "2": { "name": "keyword.others.tsx" } }, "name": "meta.indexer.declaration.tsx", "patterns": [ { "include": "#type-annotation" }, { "include": "#indexer-parameter" }, { "include": "#expression" } ] }, "indexer-parameter": { "captures": { "1": { "name": "variable.parameter.tsx" } }, "match": "([a-zA-Z_$][\\w$]*)(?=\\:)", "name": "meta.indexer.parameter.tsx" }, "jsx": { "name": "meta.jsx.tsx", "patterns": [ { "include": "#jsx-tag-without-attributes" }, { "include": "#jsx-tag-open" }, { "include": "#jsx-tag-close" }, { "include": "#jsx-tag-invalid" }, { "begin": "(?<=(?:'|\"|})>)", "end": "(?=|/\\*|//)", "name": "meta.tag.attribute-name.tsx" }, "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-attributes-illegal": { "match": "\\S+", "name": "invalid.illegal.attribute.tsx" }, "jsx-tag-close": { "begin": "()", "endCaptures": { "1": { "name": "punctuation.definition.tag.end.tsx" } }, "name": "tag.close.tsx", "patterns": [ { "include": "#comment" } ] }, "jsx-tag-invalid": { "match": "<\\s*>", "name": "invalid.illegal.tag.incomplete.tsx" }, "jsx-tag-open": { "begin": "(?x)\n (<)\n ([_$a-zA-Z][-$\\w.]*(?)", "beginCaptures": { "1": { "name": "punctuation.definition.tag.begin.tsx" }, "2": { "name": "entity.name.tag.tsx" } }, "end": "(/?>)", "endCaptures": { "1": { "name": "punctuation.definition.tag.end.tsx" } }, "name": "tag.open.tsx", "patterns": [ { "include": "#comment" }, { "include": "#jsx-tag-attributes" }, { "include": "#jsx-tag-attributes-illegal" } ] }, "jsx-tag-without-attributes": { "begin": "(<)([_$a-zA-Z][-$\\w.]*(?)", "beginCaptures": { "1": { "name": "punctuation.definition.tag.begin.tsx" }, "2": { "name": "entity.name.tag.tsx" }, "3": { "name": "punctuation.definition.tag.end.tsx" } }, "end": "()", "endCaptures": { "1": { "name": "punctuation.definition.tag.begin.tsx" }, "2": { "name": "entity.name.tag.tsx" }, "3": { "name": "punctuation.definition.tag.end.tsx" } }, "name": "tag.without-attributes.tsx", "patterns": [ { "include": "#jsx-children" } ] }, "literal": { "name": "literal.tsx", "patterns": [ { "include": "#numeric-literal" }, { "include": "#boolean-literal" }, { "include": "#null-literal" }, { "include": "#undefined-literal" }, { "include": "#array-literal" }, { "include": "#this-literal" } ] }, "logic-operator": { "match": "\\!|&&|&|~|\\^|\\|\\||\\|", "name": "keyword.operator.arithmetic.tsx" }, "method-declaration": { "begin": "\\b(?:(abstract)\\s+)?\\b(?:(public|private|protected)\\s+)?\\b(?:(async)\\s+)?(?:(get|set)\\s+)?(?:(new)|(?:\\b(constructor)\\b)|(?:([a-zA-Z_$][\\.\\w$]*)\\s*(\\??)))?\\s*(?=\\(|\\<)", "beginCaptures": { "1": { "name": "storage.modifier.tsx" }, "2": { "name": "storage.modifier.tsx" }, "3": { "name": "storage.modifier.tsx" }, "4": { "name": "storage.type.property.tsx" }, "5": { "name": "keyword.operator.tsx" }, "6": { "name": "storage.type.tsx" }, "7": { "name": "entity.name.function.tsx" }, "8": { "name": "keyword.operator.tsx" } }, "end": "(?=\\}|;|,)|(?<=\\})", "name": "meta.method.declaration.tsx", "patterns": [ { "include": "#comment" }, { "include": "#type-parameters" }, { "include": "#function-type-parameters" }, { "include": "#type-annotation" }, { "include": "#method-overload-declaration" }, { "include": "#decl-block" } ] }, "method-overload-declaration": { "captures": { "1": { "name": "storage.modifier.tsx" }, "2": { "name": "storage.modifier.tsx" }, "3": { "name": "storage.modifier.tsx" }, "4": { "name": "storage.type.property.tsx" }, "5": { "name": "keyword.operator.tsx" }, "6": { "name": "storage.type.tsx" }, "7": { "name": "entity.name.function.tsx" }, "8": { "name": "keyword.operator.tsx" } }, "match": "\\b(?:(abstract)\\s+)?\\b(?:(public|private|protected)\\s+)?\\b(?:(async)\\s+)?(?:(get|set)\\s+)?(?:(new)|(?:\\b(constructor)\\b)|(?:([a-zA-Z_$][\\.\\w$]*)\\s*(\\??)))?\\s*(?=\\(|\\<)", "name": "meta.method.overload.declaration.tsx" }, "new-expr": { "begin": "\\b(new)\\b", "beginCaptures": { "1": { "name": "keyword.others.tsx" } }, "end": "(?=[(;]|$)", "name": "new.expr.tsx", "patterns": [ { "include": "#type" }, { "include": "#comment" } ] }, "null-literal": { "match": "\\b(null)\\b", "name": "constant.language.null.tsx" }, "numeric-literal": { "match": "\\b(?<=[^$])((0(x|X)[0-9a-fA-F]+)|(0(o|O)[0-7]+)|(0(b|B)(0|1)+)|(([0-9]+(\\.[0-9]+)?))([eE]([+-]?)[0-9]+(\\.[0-9]+)?)?)\\b", "name": "constant.numeric.tsx" }, "object-body": { "begin": "\\{", "beginCaptures": { "0": { "name": "meta.brace.curly.tsx" } }, "end": "\\}", "endCaptures": { "0": { "name": "meta.brace.curly.tsx" } }, "name": "meta.object.body.tsx", "patterns": [ { "include": "#string" }, { "include": "#comment" }, { "include": "#field-declaration" }, { "include": "#method-declaration" }, { "include": "#indexer-declaration" }, { "include": "#type-annotation" }, { "include": "#variable-initializer" }, { "include": "#access-modifier" }, { "include": "#static-modifier" }, { "include": "#property-accessor" } ] }, "object-declaration": { "begin": "\\b(?:(export)\\s+)?\\b(?:(abstract)\\s+)?\\b(?=|<>|=|<|>", "name": "keyword.operator.comparison.tsx" }, "return-type": { "begin": "(?<=\\))\\s*:", "end": "(?=$)|(?=\\{|;|//)", "name": "meta.return.type.tsx", "patterns": [ { "include": "#type" } ] }, "static-modifier": { "match": "\\b(static)\\b", "name": "keyword.other.tsx" }, "storage-keyword": { "match": "\\b(var|let|function|const|module|namespace|void|export)\\b", "name": "storage.type.tsx" }, "string": { "name": "string.tsx", "patterns": [ { "include": "#qstring-single" }, { "include": "#qstring-double" } ] }, "string-character-escape": { "match": "\\\\(x\\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)", "name": "constant.character.escape" }, "switch-block": { "begin": "{", "end": "(?=\\})", "name": "switch-block.expr.tsx", "patterns": [ { "include": "#expression" } ] }, "switch-expression": { "begin": "\\b(switch)\\b\\s*\\(", "beginCaptures": { "1": { "name": "keyword.control.tsx" } }, "end": "\\)", "name": "switch-expression.expr.tsx", "patterns": [ { "include": "#expression" } ] }, "switch-statement": { "begin": "(?=\\bswitch\\b\\s*\\()", "end": "}", "name": "switch-statement.expr.tsx", "patterns": [ { "include": "#switch-expression" }, { "include": "#switch-block" } ] }, "template": { "begin": "`", "beginCaptures": { "0": { "name": "string.template.tsx" } }, "end": "`", "endCaptures": { "0": { "name": "string.template.tsx" } }, "name": "meta.template.tsx", "patterns": [ { "include": "#template-substitution-element" }, { "include": "#template-string-contents" } ] }, "template-string-contents": { "begin": ".*?", "end": "(?=(\\$\\{|`))", "name": "string.template.tsx", "patterns": [ { "include": "#string-character-escape" } ] }, "template-substitution-element": { "begin": "\\$\\{", "beginCaptures": { "0": { "name": "keyword.others.tsx" } }, "end": "\\}", "endCaptures": { "0": { "name": "keyword.others.tsx" } }, "name": "template.element.tsx", "patterns": [ { "include": "#expression" } ] }, "ternary-expression": { "begin": "(?=\\?)", "end": "(?=$|[;,])", "patterns": [ { "include": "#ternary-operator" }, { "include": "#expression-type" } ] }, "ternary-operator": { "begin": "(\\?)", "end": "(:)", "patterns": [ { "include": "#expression-type" } ] }, "this-literal": { "match": "\\b(this)\\b", "name": "constant.language.this.tsx" }, "type": { "name": "meta.type.tsx", "patterns": [ { "include": "#type-primitive" }, { "include": "#type-parameters" }, { "include": "#type-tuple" }, { "include": "#type-object" }, { "include": "#type-operator" }, { "include": "#type-paren-or-function-type-parameters" }, { "include": "#type-function-return-type" }, { "include": "#type-name" } ] }, "type-annotation": { "begin": ":", "end": "(?=$|[,);\\}\\]]|//)|(?==[^>])|(?<=[\\}>\\]\\)]|[a-zA-Z_$])\\s*(?=\\{)", "name": "meta.type.annotation.tsx", "patterns": [ { "include": "#expression-operator" }, { "include": "#type" }, { "include": "#string" }, { "include": "#comment" } ] }, "type-declaration": { "begin": "\\b(type)\\b\\s+([a-zA-Z_$][\\w$]*)\\s*", "beginCaptures": { "1": { "name": "keyword.other.tsx" }, "2": { "name": "entity.name.class.tsx" } }, "end": "(?=$|[,);>]|var|type|function|class|interface)", "name": "meta.type.declaration.tsx", "patterns": [ { "include": "#type-parameters" }, { "include": "#type" }, { "match": "=\\s*", "name": "keyword.operator.comparison.tsx" } ] }, "type-function-return-type": { "begin": "=>", "beginCaptures": { "0": { "name": "keyword.operator.tsx" } }, "end": "(?=\\s*[,\\)\\{=;>]|//|$)", "name": "meta.type.function.return.tsx", "patterns": [ { "include": "#type" } ] }, "type-name": { "captures": { "1": { "name": "entity.name.type.tsx" } }, "match": "[a-zA-Z_$][.\\w$]*", "name": "meta.type.name.tsx" }, "type-object": { "begin": "\\{", "beginCaptures": { "0": { "name": "meta.brace.curly.tsx" } }, "end": "\\}", "endCaptures": { "0": { "name": "meta.brace.curly.tsx" } }, "name": "meta.object.type.tsx", "patterns": [ { "include": "#comment" }, { "include": "#field-declaration" }, { "include": "#method-declaration" }, { "include": "#indexer-declaration" }, { "include": "#type-annotation" } ] }, "type-operator": { "match": "[.|]", "name": "keyword.operator.type.tsx" }, "type-parameters": { "begin": "([a-zA-Z_$][\\w$]*)?(<)", "beginCaptures": { "1": { "name": "entity.name.type.tsx" }, "2": { "name": "meta.brace.angle.tsx" } }, "end": "(?=$)|(>)", "endCaptures": { "2": { "name": "meta.brace.angle.tsx" } }, "name": "meta.type.parameters.tsx", "patterns": [ { "match": "\\b(extends)\\b", "name": "keyword.other.tsx" }, { "include": "#comment" }, { "include": "#type" } ] }, "type-paren-or-function-type-parameters": { "begin": "(?:\\b(new)\\b)?\\s*\\(", "beginCaptures": { "1": { "name": "keyword.control.tsx" } }, "end": "\\)", "name": "meta.type.paren.cover.tsx", "patterns": [ { "include": "#comment" }, { "include": "#type" }, { "include": "#function-type-parameters" } ] }, "type-primitive": { "captures": { "1": { "name": "support.type.tsx" } }, "match": "\\b(string|number|boolean|symbol|any|void)\\b", "name": "meta.type.primitive.tsx" }, "type-tuple": { "begin": "\\[", "beginCaptures": { "0": { "name": "meta.brace.square.tsx" } }, "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.tsx" } }, "name": "meta.type.tuple.tsx", "patterns": [ { "include": "#type" }, { "include": "#comment" } ] }, "undefined-literal": { "match": "\\b(undefined)\\b", "name": "constant.language.tsx" }, "var-expr": { "begin": "(?