{ "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": "<<=|>>=|>>>=|\\*=|(?|\\b(delete|export|import|in|instanceof|module|namespace|new|typeof|void|as)\\b", "name": "keyword.operator.tsx" }, "field-declaration": { "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(?:(public|private|protected)\\s+)?(?:(get|set)\\s+)?(?:(new)|(?:([a-zA-Z_$][\\.\\w$]*)\\s*(\\??)))?\\s*(?=\\(|\\<)", "beginCaptures": { "1": { "name": "storage.modifier.tsx" }, "2": { "name": "storage.type.property.tsx" }, "3": { "name": "keyword.operator.tsx" }, "4": { "name": "entity.name.function.tsx" }, "5": { "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": "keyword.operator.tsx" }, "3": { "name": "entity.name.function.tsx" }, "4": { "name": "keyword.operator.tsx" } }, "match": "\\b(?:(public|private|protected)\\s+)?(?:(new)|(?:([a-zA-Z_$][\\.\\w$]*)\\s*(\\??)))?\\s*(?=\\(|\\<)", "name": "meta.method.overload.declaration.tsx" }, "new-expr": { "begin": "\\b(new)\\b", "beginCaptures": { "1": { "name": "keyword.operator.tsx" } }, "end": "(?=[(;]|$)", "name": "new.expr.tsx", "patterns": [ { "include": "#type" } ] }, "null-literal": { "match": "\\b(null)\\b", "name": "constant.language.null.tsx" }, "numeric-literal": { "match": "\\b(?<=[^$])((0(x|X)[0-9a-fA-F]+)|([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(class|interface)\\b", "beginCaptures": { "1": { "name": "storage.modifier.tsx" }, "2": { "name": "storage.type.tsx" }, "3": { "name": "entity.name.class.tsx" } }, "end": "(?<=\\})", "endCaptures": { "1": { "name": "brace.curly.tsx" } }, "name": "meta.declaration.object.tsx", "patterns": [ { "include": "#comment" }, { "include": "#object-heritage" }, { "include": "#object-name" }, { "include": "#type-parameters" }, { "include": "#object-body" } ] }, "object-heritage": { "begin": "(?:\\b(extends|implements))", "beginCaptures": { "1": { "name": "keyword.other.tsx" } }, "end": "(?=\\{)", "endCaptures": { "1": { "name": "brace.curly.tsx" } }, "name": "meta.object.heritage.tsx", "patterns": [ { "include": "#comment" }, { "include": "#type-parameters" }, { "include": "#object-heritage-parent" } ] }, "object-heritage-parent": { "captures": { "1": { "name": "storage.type.tsx" } }, "match": "(?:\\s*([a-zA-Z_$][\\w$]*))", "name": "meta.object.heritage.parent.tsx" }, "object-member": { "begin": "[a-zA-Z_$][\\w$]*\\s*:", "end": "(?=,|\\})", "name": "meta.object.member.tsx", "patterns": [ { "include": "#expression" } ] }, "object-name": { "captures": { "0": { "name": "entity.name.class.tsx" } }, "match": "[a-zA-Z_$][\\w$]*", "name": "meta.object.name.tsx" }, "parameter-name": { "captures": { "1": { "name": "storage.modifier.tsx" }, "2": { "name": "keyword.operator.tsx" }, "3": { "name": "variable.parameter.tsx" }, "4": { "name": "keyword.operator.tsx" } }, "match": "(?:\\s*\\b(public|private|protected)\\b\\s+)?(\\.\\.\\.)?\\s*([a-zA-Z_$][\\w$]*)\\s*(\\??)", "name": "parameter.name.tsx" }, "paren-expression": { "begin": "\\(", "beginCaptures": { "0": { "name": "meta.brace.paren.tsx" } }, "end": "\\)", "endCaptures": { "0": { "name": "meta.brace.paren.tsx" } }, "patterns": [ { "include": "#expression" } ] }, "property-accessor": { "match": "\\b(get|set)\\b", "name": "storage.type.property.tsx" }, "qstring-double": { "begin": "\"", "end": "\"|(?=$)", "name": "string.double.tsx", "patterns": [ { "include": "#string-character-escape" } ] }, "qstring-single": { "begin": "'", "end": "'|(?=$)", "name": "string.single.tsx", "patterns": [ { "include": "#string-character-escape" } ] }, "regex": { "begin": "(?<=[=(:,\\[]|^|return|&&|\\|\\||!)\\s*(/)(?![/*+{}?])", "end": "$|(/)[igm]*", "name": "string.regex.tsx", "patterns": [ { "match": "\\\\.", "name": "constant.character.escape.tsx" }, { "match": "\\[(\\\\\\]|[^\\]])*\\]", "name": "constant.character.class.tsx" } ] }, "relational-operator": { "match": "===|==|=|!=|!==|<=|>=|<>|<|>", "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(number|boolean|string|var|let|function|const)\\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-case": { "begin": "(?])|(?<=[\\}>\\]\\)]|[a-zA-Z_$])\\s*(?=\\{)", "name": "meta.type.annotation.tsx", "patterns": [ { "include": "#type" }, { "include": "#string" }, { "include": "#comment" } ] }, "type-declaration": { "begin": "\\b(type)\\b\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*", "beginCaptures": { "1": { "name": "keyword.other.tsx" }, "2": { "name": "storage.type.tsx" } }, "end": "(?=[,);>]|var|type|function|class|interface)", "name": "meta.type.declaration.tsx", "patterns": [ { "include": "#type" } ] }, "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": "storage.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": "(?