diff --git a/.gitmodules b/.gitmodules index 1632b487..c8ad56c4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -67,6 +67,9 @@ [submodule "assets/themes/onehalf"] path = assets/themes/onehalf url = https://github.com/sonph/onehalf +[submodule "assets/syntaxes/JavaScript (Babel)"] + path = assets/syntaxes/JavaScript (Babel) + url = https://github.com/babel/babel-sublime [submodule "assets/syntaxes/Cabal"] path = assets/syntaxes/Cabal url = https://github.com/SublimeHaskell/SublimeHaskell diff --git a/assets/syntaxes/JavaScript (Babel) b/assets/syntaxes/JavaScript (Babel) new file mode 160000 index 00000000..a9a908fe --- /dev/null +++ b/assets/syntaxes/JavaScript (Babel) @@ -0,0 +1 @@ +Subproject commit a9a908fe1d39ec84893e6edcbb146f09e9e60cc6 diff --git a/assets/syntaxes/Javascript (Babel).sublime-syntax b/assets/syntaxes/Javascript (Babel).sublime-syntax new file mode 100644 index 00000000..e3e3fccf --- /dev/null +++ b/assets/syntaxes/Javascript (Babel).sublime-syntax @@ -0,0 +1,1288 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: JavaScript (Babel) +file_extensions: + - js + - jsx + - babel + - es6 +first_line_match: ^#!\s*/.*\b(node|js)$\n? +scope: source.js +contexts: + main: + - include: core + brackets: + - include: round-brackets + - include: square-brackets + - include: curly-brackets + class-method-definition: + - match: '(@@[_$a-zA-Z][$\w]*|static|return)(?=\s*[<(])|(?=\s*<)' + captures: + 1: keyword.operator.flowtype.js + push: + - meta_scope: meta.short-method.flowtype.js + - match: '(?=\s*[;{])' + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + - include: flowtype-annotation + - include: comments + - include: curly-brackets + - match: '(?<=[]"''])\s*(?=[<(])' + push: + - meta_scope: meta.class-method.computed.js + - match: '(?=\s*[;{])' + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + - include: flowtype-annotation + - include: comments + - include: curly-brackets + - match: |- + (?x) + ((?>get|set)\s+) + (?> + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + (([_$a-zA-Z][$\w]*|\d+)) + )(?=\s*[<(]) + captures: + 1: storage.type.js + 2: string.quoted.js + 3: punctuation.definition.string.begin.js + 4: entity.name.function.js + 5: punctuation.definition.string.end.js + 6: string.quoted.js + 7: punctuation.definition.string.begin.js + 8: entity.name.function.js + 9: punctuation.definition.string.end.js + 10: string.unquoted.js + 11: entity.name.function.js + push: + - meta_scope: meta.class-accessor.js + - match: '(?=\s*[;{])' + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + - include: flowtype-annotation + - include: comments + - include: curly-brackets + - match: |- + (?x) + (?> + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + (([_$a-zA-Z][$\w]*|\d+)) + )(?=\s*[<(]) + captures: + 1: string.quoted.js + 2: punctuation.definition.string.begin.js + 3: entity.name.function.js + 4: punctuation.definition.string.end.js + 5: string.quoted.js + 6: punctuation.definition.string.begin.js + 7: entity.name.function.js + 8: punctuation.definition.string.end.js + 9: string.unquoted.js + 10: entity.name.function.js + push: + - meta_scope: meta.class-method.js + - match: '(?=\s*[;{])' + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + - include: flowtype-annotation + - include: comments + - include: curly-brackets + class-method-storage: + - match: (?static|declare)\b + scope: storage.modifier.js + - match: (?) + scope: comment.block.html.js + captures: + 0: punctuation.definition.comment.js + - match: (//).*$\n? + scope: comment.line.double-slash.js + captures: + 1: punctuation.definition.comment.js + - match: ^(#!).*$\n? + scope: comment.line.shebang.js + captures: + 1: punctuation.definition.comment.js + core: + - include: literal-function-labels + - include: literal-arrow-function-labels + - include: literal-labels + - include: literal-for + - include: literal-switch + - include: styled-components + - include: graphql + - include: expression + - include: literal-punctuation + curly-brackets: + - match: "{" + captures: + 0: meta.brace.curly.begin.js + push: + - meta_scope: meta.group.braces.curly.js + - match: "}" + captures: + 0: meta.brace.curly.end.js + pop: true + - include: main + es7-decorators: + - match: |- + (?x) + (@)([_$a-zA-Z][$\w]*)\b + scope: tag.decorator.js + captures: + 1: punctuation.definition.tag.js + 2: entity.name.tag.js + expression: + - include: merge-conflits + - include: literal-regexp + - include: literal-jsx + - include: es7-decorators + - include: support-class + - include: support-other + - include: literal-function + - include: literal-arrow-function + - include: literal-prototype + - include: literal-keywords + - include: literal-method + - include: literal-module + - include: literal-class + - include: flowtype-declaration + - include: literal-number + - include: literal-template-string + - include: literal-string + - include: literal-language-constant + - include: literal-language-variable + - include: literal-constructor + - include: literal-method-call + - include: literal-function-call + - include: comments + - include: brackets + - include: literal-operators + - include: literal-variable + flowtype-annotation: + - match: (?:(\?)\s*)?(:) + captures: + 1: keyword.operator.flowtype.optional.js + 2: keyword.operator.flowtype.annotation.js + push: + - meta_scope: meta.flowtype.annotation.js + - include: flowtype-tokens + - match: (?=\S) + pop: true + flowtype-brackets: + - match: "{" + captures: + 0: punctuation.section.flowtype.begin.js + push: + - match: "}" + captures: + 0: punctuation.section.flowtype.end.js + pop: true + - include: flowtype-tokens + flowtype-declaration: + - match: (?" + captures: + 0: punctuation.section.flowtype.end.js + pop: true + - include: flowtype-tokens + flowtype-tokens: + - match: '(?<=[:?|&=])(?=\s*{)' + push: + - match: "(?<=})" + pop: true + - include: flowtype-brackets + - match: '\s*([|&])\s*' + scope: meta.flowtype.set.js + captures: + 1: keyword.operator.flowtype.other.js + - match: '[*:?&|.]|\.\.\.|\b(typeof)\b' + scope: keyword.operator.flowtype.other.js + - match: < + captures: + 0: punctuation.section.flowtype.begin.js + push: + - match: ">" + captures: + 0: punctuation.section.flowtype.end.js + pop: true + - include: flowtype-tokens + - match: '\[' + captures: + 0: punctuation.section.flowtype.begin.js + push: + - match: '\]' + captures: + 0: punctuation.section.flowtype.end.js + pop: true + - include: flowtype-tokens + - match: \( + captures: + 0: punctuation.section.flowtype.begin.js + push: + - match: \) + captures: + 0: punctuation.section.flowtype.end.js + pop: true + - include: flowtype-tokens + - match: "=>" + captures: + 0: keyword.operator.flowtype.js + push: + - meta_scope: meta.flowtype.function.js + - match: "(?<=}|[_$a-zA-Z])" + pop: true + - include: flowtype-brackets + - include: flowtype-identifier + - include: comments + - include: flowtype-identifier + - include: literal-string + - include: comments + function-declaration-parameters: + - match: \( + captures: + 0: punctuation.definition.parameters.begin.js + push: + - match: \) + captures: + 0: punctuation.definition.parameters.end.js + pop: true + - include: comments + - include: flowtype-annotation + - match: (?" + captures: + 0: meta.tag.jsx punctuation.definition.tag.end.jsx + push: + - match: (?=)|(/>) + captures: + 1: meta.tag.jsx punctuation.definition.tag.begin.jsx + 2: meta.tag.jsx entity.name.tag.jsx + 3: meta.tag.jsx punctuation.definition.tag.end.jsx + 4: meta.tag.jsx punctuation.definition.tag.end.jsx + pop: true + - include: jsx-tag-end + - include: jsx-attributes + - match: < + scope: invalid.illegal.tag.incomplete.jsx + literal-arrow-function: + - match: |- + (?x) + (?:([_$a-zA-Z][$\w]*)\s*(=)\s*)? + (?:\b(async)\s+)? + (?=(\((?>(?>[^()]+)|\g<-1>)*\))\s*(=>)) + captures: + 1: entity.name.function.js + 2: keyword.operator.assignment.js + 3: storage.type.js + push: + - meta_scope: meta.function.arrow.js + - match: (?<=\))\s*(=>) + captures: + 1: storage.type.function.arrow.js + pop: true + - include: function-declaration-parameters + - match: |- + (?x) + (?:([_$a-zA-Z][$\w]*)\s*(=)\s*)? + (?:(async)\s+)? + \b([_$a-zA-Z][$\w]*)\s*(=>) + scope: meta.function.arrow.js + captures: + 1: entity.name.function.js + 2: keyword.operator.assignment.js + 3: storage.type.js + 4: variable.parameter.function.js + 5: storage.type.function.arrow.js + - match: |- + (?x) + (\b_?[A-Z][$\w]*)? + (\.)(prototype) + (\.)([_$a-zA-Z][$\w]*) + \s*(=) + \s*(async)? + \s*(?=(\((?>(?>[^()]+)|\g<-1>)*\))\s*(=>)) + captures: + 1: entity.name.class.js + 2: keyword.operator.accessor.js + 3: variable.language.prototype.js + 4: keyword.operator.accessor.js + 5: entity.name.function.js + 6: keyword.operator.assignment.js + 7: storage.type.js + push: + - meta_scope: meta.prototype.function.arrow.js + - match: (?<=\))\s*(=>) + captures: + 1: storage.type.function.arrow.js + pop: true + - include: function-declaration-parameters + - match: |- + (?x) + (\b_?[A-Z][$\w]*)? + (\.)(prototype) + (\.)([_$a-zA-Z][$\w]*) + \s*(=) + \s*(async)? + \s*\b([_$a-zA-Z][$\w]*)\s*(=>) + scope: meta.prototype.function.arrow.js + captures: + 1: entity.name.class.js + 2: keyword.operator.accessor.js + 3: variable.language.prototype.js + 4: keyword.operator.accessor.js + 5: entity.name.function.js + 6: keyword.operator.assignment.js + 7: storage.type.js + 8: variable.parameter.function.js + 9: storage.type.function.arrow.js + - match: |- + (?x) + (\b_?[A-Z][$\w]*)? + (\.)([_$a-zA-Z][$\w]*) + \s*(=) + \s*(async)? + \s*(?=(\((?>(?>[^()]+)|\g<-1>)*\))\s*(=>)) + captures: + 1: entity.name.class.js + 2: keyword.operator.accessor.js + 3: entity.name.function.js + 4: keyword.operator.assignment.js + 5: storage.type.js + push: + - meta_scope: meta.function.static.arrow.js + - match: (?<=\))\s*(=>) + captures: + 1: storage.type.function.arrow.js + pop: true + - include: function-declaration-parameters + - match: |- + (?x) + (\b_?[A-Z][$\w]*)? + (\.)([_$a-zA-Z][$\w]*) + \s*(=) + \s*(async)? + \s*\b([_$a-zA-Z][$\w]*)\s*(=>) + scope: meta.function.static.arrow.js + captures: + 1: entity.name.class.js + 2: keyword.operator.accessor.js + 3: entity.name.function.js + 4: keyword.operator.assignment.js + 5: storage.type.js + 6: variable.parameter.function.js + 7: storage.type.function.arrow.js + literal-arrow-function-labels: + - match: |- + (?x) + (?> + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + (([_$a-zA-Z][$\w]*|\d+)) + ) + \s*(:) + \s*(?:\b(async)\s+)? + \s*(?=(\((?>(?>[^()]+)|\g<-1>)*\))\s*(=>)) + captures: + 1: string.quoted.js + 2: punctuation.definition.string.begin.js + 3: entity.name.function.js + 4: punctuation.definition.string.end.js + 5: string.quoted.js + 6: punctuation.definition.string.begin.js + 7: entity.name.function.js + 8: punctuation.definition.string.end.js + 9: string.unquoted.js + 10: entity.name.function.js + 11: punctuation.separator.key-value.js + 12: storage.type.js + push: + - meta_scope: meta.function.json.arrow.js + - match: (?<=\))\s*(=>) + captures: + 1: storage.type.function.arrow.js + pop: true + - include: function-declaration-parameters + - match: |- + (?x) + (?> + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + (([_$a-zA-Z][$\w]*|\d+)) + ) + \s*(:) + \s*(?:\b(async)\s+)? + \s*\b([_$a-zA-Z][$\w]*)\s*(=>) + scope: meta.function.json.arrow.js + captures: + 1: string.quoted.js + 2: punctuation.definition.string.begin.js + 3: entity.name.function.js + 4: punctuation.definition.string.end.js + 5: string.quoted.js + 6: punctuation.definition.string.begin.js + 7: entity.name.function.js + 8: punctuation.definition.string.end.js + 9: string.unquoted.js + 10: entity.name.function.js + 11: punctuation.separator.key-value.js + 12: storage.type.js + 13: variable.parameter.function.js + 14: storage.type.function.arrow.js + literal-class: + - match: (?\s*(\*)|(?=[\s(<])) + \s*([_$a-zA-Z][$\w]*)? + captures: + 1: entity.name.function.js + 2: keyword.operator.assignment.js + 3: storage.type.js + 4: storage.type.function.js + 5: keyword.generator.asterisk.js + 6: entity.name.function.js + push: + - meta_scope: meta.function.js + - match: (?<=\)) + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + - match: |- + (?x) + (\b_?[A-Z][$\w]*)? + (\.)(prototype) + (\.)([_$a-zA-Z][$\w]*) + \s*(=) + \s*(?:(async)\s+)? + \s*(function)(?>\s*(\*)|(?=[\s(<])) + \s*([_$a-zA-Z][$\w]*)?\s* + captures: + 1: entity.name.class.js + 2: keyword.operator.accessor.js + 3: variable.language.prototype.js + 4: keyword.operator.accessor.js + 5: entity.name.function.js + 6: keyword.operator.assignment.js + 7: storage.type.js + 8: storage.type.function.js + 9: keyword.generator.asterisk.js + 10: entity.name.function.js + push: + - meta_scope: meta.function.prototype.js + - match: (?<=\)) + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + - match: |- + (?x) + (\b_?[A-Z][$\w]*)? + (\.)([_$a-zA-Z][$\w]*) + \s*(=) + \s*(?:(async)\s+)? + \s*(function)(?>\s*(\*)|(?=[\s(<])) + \s*([_$a-zA-Z][$\w]*)?\s* + captures: + 1: entity.name.class.js + 2: keyword.operator.accessor.js + 3: entity.name.function.js + 4: keyword.operator.assignment.js + 5: storage.type.js + 6: storage.type.function.js + 7: keyword.generator.asterisk.js + 8: entity.name.function.js + push: + - meta_scope: meta.function.static.js + - match: (?<=\)) + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + literal-function-call: + - match: '([_$a-zA-Z][$\w]*)\s*(\(\s*\))' + scope: meta.function-call.without-arguments.js + captures: + 1: variable.function.js + 2: meta.group.braces.round.function.arguments.js + - match: '([_$a-zA-Z][$\w]*)\s*(?=\()' + scope: meta.function-call.with-arguments.js + captures: + 1: variable.function.js + - match: '([_$a-zA-Z][$\w]*)\s*(?=`)' + scope: meta.function-call.tagged-template.js + captures: + 1: variable.function.js + literal-function-labels: + - match: |- + (?x) + (?> + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + (([_$a-zA-Z][$\w]*|\d+)) + ) + \s*(:) + \s*(?:\b(async)\s+)? + \s*(function)(?>\s*(\*)|(?=[\s(<])) + \s*([_$a-zA-Z][$\w]*)? + captures: + 1: string.quoted.js + 2: punctuation.definition.string.begin.js + 3: entity.name.function.js + 4: punctuation.definition.string.end.js + 5: string.quoted.js + 6: punctuation.definition.string.begin.js + 7: entity.name.function.js + 8: punctuation.definition.string.end.js + 9: string.unquoted.js + 10: entity.name.function.js + 11: punctuation.separator.key-value.js + 12: storage.type.js + 13: storage.type.function.js + 14: keyword.generator.asterisk.js + 15: entity.name.function.js + push: + - meta_scope: meta.function.json.js + - match: (?<=\)) + pop: true + - include: flowtype-polymorph + - include: function-declaration-parameters + literal-jsx: + - match: '(?<=\(|\{|\[|,|&&|\|\||\?|:|=|=>|\Wreturn|^return|\Wdefault|^)(?=\s*<[_$a-zA-Z])' + push: + - meta_content_scope: meta.jsx.js + - match: (?<=/>|>) + pop: true + - include: jsx-tag-start + literal-keyword-storage: + - match: (?const|let|var)\b + scope: storage.type.js + literal-keywords: + - include: literal-keyword-storage + - match: (?await|yield))\b(?:\s*(\*))? + captures: + 1: keyword.control.flow.js + 2: keyword.generator.asterisk.js + - match: (?if|else)\b + scope: keyword.control.conditional.js + - match: (?catch|finally|throw|try)\b + scope: keyword.control.trycatch.js + - match: (?break|continue|do|goto|while|case|default)\b + scope: keyword.control.loop.js + - match: (?enum|module|public|package|private|interface|protected)\b + scope: keyword.other.reserved.js + - match: (? + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + )\s*:) + push: + - match: ":" + captures: + 0: punctuation.separator.key-value.js + pop: true + - include: literal-string + - match: '(? + ((')((?>[^'\\]|\\.)*)('))| + ((")((?>[^"\\]|\\.)*)("))| + (([_$a-zA-Z][$\w]*|\d+)) + ) + (?=\s*(\((?>(?>[^()]+)|\g<-1>)*\))(?>\s|/\*.*\*/)*\{) + captures: + 1: storage.type.js + 2: storage.type.js + 3: keyword.generator.asterisk.js + 4: string.quoted.js + 5: punctuation.definition.string.begin.js + 6: entity.name.function.js + 7: punctuation.definition.string.end.js + 8: string.quoted.js + 9: punctuation.definition.string.begin.js + 10: entity.name.function.js + 11: punctuation.definition.string.end.js + 12: string.unquoted.js + 13: entity.name.function.js + push: + - meta_scope: meta.method.js + - match: (?<=\)) + pop: true + - include: function-declaration-parameters + - match: |- + (?x) + \b(?:(static)\s+)? + (get|set)\s+ + ([_$a-zA-Z][$\w]*|\d+)\s* + (?=(\((?>(?>[^()]+)|\g<-1>)*\))(?>\s|/\*.*\*/)*\{) + captures: + 1: storage.type.js + 2: storage.type.accessor.js + 3: entity.name.accessor.js + push: + - meta_scope: meta.accessor.js + - match: (?<=\)) + pop: true + - include: function-declaration-parameters + literal-method-call: + - match: |- + (?x) + (?:(?<=\.)|\b) + ([A-Z][$\w]*)\s*(\.) + ([_$a-zA-Z][$\w]*)\s* + (\(\s*\)) + scope: meta.function-call.static.without-arguments.js + captures: + 1: variable.other.class.js + 2: keyword.operator.accessor.js + 3: variable.function.js + 4: meta.group.braces.round.function.arguments.js + - match: |- + (?x) + (?:(?<=\.)|\b) + ([A-Z][$\w]*)\s*(\.) + ([_$a-zA-Z][$\w]*)\s* + (?=\() + scope: meta.function-call.static.with-arguments.js + captures: + 1: variable.other.class.js + 2: keyword.operator.accessor.js + 3: variable.function.js + - match: |- + (?x) + (?<=\.) + ([_$a-zA-Z][$\w]*)\s* + (\(\s*\)) + scope: meta.function-call.method.without-arguments.js + captures: + 1: variable.function.js + 2: meta.group.braces.round.function.arguments.js + - match: |- + (?x) + (?<=\.) + ([_$a-zA-Z][$\w]*)\s* + (?=\() + scope: meta.function-call.method.with-arguments.js + captures: + 1: variable.function.js + literal-module: + - match: (?import|export|default|from|as)\b + scope: keyword.operator.module.js + literal-number: + - match: '(?i)(?:\B[-+]|\b)0x[0-9a-f]*\.(\B|\b[0-9]+)' + scope: invalid.illegal.numeric.hex.js + - match: '(?:\B[-+]|\b)0[0-9]+\.(\B|\b[0-9]+)' + scope: invalid.illegal.numeric.octal.js + - match: |- + (?xi) + (?:\B[-+])? + (?: + \b0b[0-1]*| # binary + \b0o[0-7]*| # octal + \b0x[0-9a-f]*| # hex + ( + \B\.[0-9]+| # e.g. .999 + \b[0-9]+(\.[0-9]*)? # e.g. 999.999, 999. or 999 + )(e[-+]?[0-9]+)? # e.g. e+123, E-123 + ) + scope: constant.numeric.js + - match: '(?:\B[-+]|\b)(Infinity)\b' + scope: constant.language.infinity.js + literal-operators: + - match: (?delete|instanceof|in|new|of|typeof|void|with)\b + scope: keyword.operator.js + - match: |- + (?x) + !(?!=)| # logical-not right-to-left right + && | # logical-and left-to-right both + \|\| # logical-or left-to-right both + scope: keyword.operator.logical.js + - match: |- + (?x) + =(?!=) # assignment right-to-left both + scope: keyword.operator.assignment.js + - match: |- + (?x) + %= | # assignment right-to-left both + &= | # assignment right-to-left both + \*= | # assignment right-to-left both + \+= | # assignment right-to-left both + -= | # assignment right-to-left both + /= | # assignment right-to-left both + \^= | # assignment right-to-left both + \|= | # assignment right-to-left both + <<= | # assignment right-to-left both + >>= | # assignment right-to-left both + >>>= # assignment right-to-left both + scope: keyword.operator.assignment.augmented.js + - match: |- + (?x) + ~ | # bitwise-not right-to-left right + << | # bitwise-shift left-to-right both + >>> | # bitwise-shift left-to-right both + >> | # bitwise-shift left-to-right both + & | # bitwise-and left-to-right both + \^ | # bitwise-xor left-to-right both + \| # bitwise-or left-to-right both + scope: keyword.operator.bitwise.js + - match: |- + (?x) + <= | # relational left-to-right both + >= | # relational left-to-right both + < | # relational left-to-right both + > # relational left-to-right both + scope: keyword.operator.relational.js + - match: |- + (?x) + === | # equality left-to-right both + !== | # equality left-to-right both + == | # equality left-to-right both + != # equality left-to-right both + scope: keyword.operator.comparison.js + - match: |- + (?x) + -- | # decrement n/a right-or-left + \+\+ | # increment n/a right-or-left + / | # division left-to-right both + % | # modulus left-to-right both + \* | # multiplication left-to-right both + \+ | # addition left-to-right both + - # subtraction left-to-right both + scope: keyword.operator.arithmetic.js + - match: "[?:]" + scope: keyword.operator.ternary.js + - match: (?|<=|>=|==|!=|===|!==|\+|-|\*|%|\+\+|--|<<|>>|>>>|&|\||\^|!|~|&&|\|\||\?|:|=|\+=|-=|\*=|%=|<<=|>>=|>>>=|&=|\|=|\^=|/|/=| + \Wnew|\Wdelete|\Wvoid|\Wtypeof|\Winstanceof|\Win|\Wdo|\Wreturn|\Wcase|\Wthrow|\Wyield| + ^new|^delete|^void|^typeof|^instanceof|^in|^do|^return|^case|^throw|^yield|^ + )\s* + (/) + (?!/|\*|$) + captures: + 1: punctuation.definition.string.begin.js + push: + - meta_scope: string.regexp.js + - match: "(/)([gimy]*)" + captures: + 1: punctuation.definition.string.end.js + 2: keyword.other.js + pop: true + - include: scope:source.regexp.js + literal-string: + - match: '(["''])' + captures: + 0: punctuation.definition.string.begin.js + push: + - meta_scope: string.quoted.js + - match: (\1)|(\n) + captures: + 1: punctuation.definition.string.end.js + 2: invalid.illegal.newline.js + pop: true + - include: string-content + literal-switch: + - match: (?]{7})\s(.+)$' + captures: + 1: invalid.illegal.conflict-marker.other-commit.js + 2: invalid.illegal.string.js + round-brackets: + - match: \( + captures: + 0: meta.brace.round.begin.js + push: + - meta_scope: meta.group.braces.round.js + - match: \) + captures: + 0: meta.brace.round.end.js + pop: true + - include: expression + square-brackets: + - match: '\[' + captures: + 0: meta.brace.square.begin.js + push: + - meta_scope: meta.group.braces.square.js + - match: '\]' + captures: + 0: meta.brace.square.end.js + pop: true + - include: expression + string-content: + - match: \\\s*\n + scope: constant.character.escape.newline.js + - match: '\\([1-7][0-7]{0,2}|[0-7]{2,3}|[bfnrtv0''"\\]|x\h{2}|u\{\h+\}|u\h{4})' + scope: constant.character.escape.js + styled-components: + - match: (?(?>[^()]+)|\g<-1>)*\))\s*`)' + captures: + 1: meta.function-call.with-arguments.js variable.function.js + push: + - meta_scope: meta.styled-components.js + - match: (?<=`) + captures: + 1: meta.function-call.with-arguments.js variable.function.js + pop: true + - match: \( + captures: + 0: punctuation.definition.group.begin.js + push: + - meta_scope: meta.function-call.with-arguments.js meta.group.js + - match: \) + captures: + 0: punctuation.definition.group.end.js + pop: true + - include: expression + - match: "`" + captures: + 0: punctuation.definition.string.template.begin.js + push: + - meta_content_scope: source.css.embedded.js + - match: "`" + captures: + 0: punctuation.definition.string.template.end.js + pop: true + - include: scope:source.js.css + support-class: + - match: (?Eval|Range|Reference|Syntax|Type|URI)?Error)\b + scope: support.class.error.js + - match: \b(?>Buffer)\b + scope: support.class.node.js + support-other: + - match: (?document|window)\b + scope: support.type.object.dom.js + - match: (?global|GLOBAL|root|__dirname|__filename)\b + scope: support.type.object.node.js + - match: (?]|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^yield|[^\._$[:alnum:]]yield|^throw|[^\._$[:alnum:]]throw|^in|[^\._$[:alnum:]]in|^of|[^\._$[:alnum:]]of|^typeof|[^\._$[:alnum:]]typeof|&&|\|\||\*)\s*(\{)' + captures: + 1: punctuation.definition.block.tsx + push: + - meta_scope: meta.objectliteral.tsx + - match: '\}' + captures: + 0: punctuation.definition.block.tsx + pop: true + - include: object-member + array-binding-pattern: + - match: '(?:(\.\.\.)\s*)?(\[)' + captures: + 1: keyword.operator.rest.tsx + 2: punctuation.definition.binding-pattern.array.tsx + push: + - match: '\]' + captures: + 0: punctuation.definition.binding-pattern.array.tsx + pop: true + - include: binding-element + - include: punctuation-comma + array-binding-pattern-const: + - match: '(?:(\.\.\.)\s*)?(\[)' + captures: + 1: keyword.operator.rest.tsx + 2: punctuation.definition.binding-pattern.array.tsx + push: + - match: '\]' + captures: + 0: punctuation.definition.binding-pattern.array.tsx + pop: true + - include: binding-element-const + - include: punctuation-comma + array-literal: + - match: '\s*(\[)' + captures: + 1: meta.brace.square.tsx + push: + - meta_scope: meta.array.literal.tsx + - match: '\]' + captures: + 0: meta.brace.square.tsx + pop: true + - include: expression + - include: punctuation-comma + arrow-function: + - match: '(?:(?)' + scope: meta.arrow.tsx + captures: + 1: storage.modifier.async.tsx + 2: variable.parameter.tsx + - match: |- + (?x) (?: + (? is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + ) + ) + captures: + 1: storage.modifier.async.tsx + push: + - meta_scope: meta.arrow.tsx + - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))' + pop: true + - include: comment + - include: type-parameters + - include: function-parameters + - include: arrow-return-type + - match: "=>" + captures: + 0: storage.type.function.arrow.tsx + push: + - meta_scope: meta.arrow.tsx + - match: '(?<=\}|\S)(?)|((?!\{)(?=\S))' + pop: true + - include: decl-block + - include: expression + arrow-return-type: + - match: (?<=\))\s*(:) + captures: + 1: keyword.operator.type.annotation.tsx + push: + - meta_scope: meta.return.type.arrow.tsx + - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))' + pop: true + - include: arrow-return-type-body + arrow-return-type-body: + - match: '(?<=[:])(?=\s*\{)' + push: + - match: '(?<=\})' + pop: true + - include: type-object + - include: type-predicate-operator + - include: type + async-modifier: + - match: '(?\s*$)' + captures: + 1: punctuation.definition.comment.tsx + push: + - meta_scope: comment.line.triple-slash.directive.tsx + - match: (?=^) + pop: true + - match: (<)(reference|amd-dependency|amd-module) + captures: + 1: punctuation.definition.tag.directive.tsx + 2: entity.name.tag.directive.tsx + push: + - meta_scope: meta.tag.tsx + - match: /> + captures: + 0: punctuation.definition.tag.directive.tsx + pop: true + - match: path|types|no-default-lib|lib|name + scope: entity.other.attribute-name.directive.tsx + - match: "=" + scope: keyword.operator.assignment.tsx + - include: string + docblock: + - match: |- + (?x) + ((@)(?:access|api)) + \s+ + (private|protected|public) + \b + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: constant.language.access-type.jsdoc + - match: |- + (?x) + ((@)author) + \s+ + ( + [^@\s<>*/] + (?:[^@<>*/]|\*[^/])* + ) + (?: + \s* + (<) + ([^>\s]+) + (>) + )? + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: entity.name.type.instance.jsdoc + 4: punctuation.definition.bracket.angle.begin.jsdoc + 5: constant.other.email.link.underline.jsdoc + 6: punctuation.definition.bracket.angle.end.jsdoc + - match: |- + (?x) + ((@)borrows) \s+ + ((?:[^@\s*/]|\*[^/])+) # + \s+ (as) \s+ # as + ((?:[^@\s*/]|\*[^/])+) # + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: entity.name.type.instance.jsdoc + 4: keyword.operator.control.jsdoc + 5: entity.name.type.instance.jsdoc + - match: ((@)example)\s+ + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - meta_scope: meta.example.jsdoc + - match: (?=@|\*/) + pop: true + - match: ^\s\*\s+ + - match: \G(<)caption(>) + captures: + 0: entity.name.tag.inline.jsdoc + 1: punctuation.definition.bracket.angle.begin.jsdoc + 2: punctuation.definition.bracket.angle.end.jsdoc + push: + - meta_content_scope: constant.other.description.jsdoc + - match: ()|(?=\*/) + captures: + 0: entity.name.tag.inline.jsdoc + 1: punctuation.definition.bracket.angle.begin.jsdoc + 2: punctuation.definition.bracket.angle.end.jsdoc + pop: true + - match: '[^\s@*](?:[^*]|\*[^/])*' + captures: + 0: source.embedded.tsx + - match: (?x) ((@)kind) \s+ (class|constant|event|external|file|function|member|mixin|module|namespace|typedef) \b + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: constant.language.symbol-type.jsdoc + - match: |- + (?x) + ((@)see) + \s+ + (?: + # URL + ( + (?=https?://) + (?:[^\s*]|\*[^/])+ + ) + | + # JSDoc namepath + ( + (?! + # Avoid matching bare URIs (also acceptable as links) + https?:// + | + # Avoid matching {@inline tags}; we match those below + (?:\[[^\[\]]*\])? # Possible description [preceding]{@tag} + {@(?:link|linkcode|linkplain|tutorial)\b + ) + # Matched namepath + (?:[^@\s*/]|\*[^/])+ + ) + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.link.underline.jsdoc + 4: entity.name.type.instance.jsdoc + - match: |- + (?x) + ((@)template) + \s+ + # One or more valid identifiers + ( + [A-Za-z_$] # First character: non-numeric word character + [\w$.\[\]]* # Rest of identifier + (?: # Possible list of additional identifiers + \s* , \s* + [A-Za-z_$] + [\w$.\[\]]* + )* + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + - match: |- + (?x) + ( + (@) + (?:arg|argument|const|constant|member|namespace|param|var) + ) + \s+ + ( + [A-Za-z_$] + [\w$.\[\]]* + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + - match: '((@)typedef)\s+(?={)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])' + pop: true + - include: jsdoctype + - match: '(?:[^@\s*/]|\*[^/])+' + scope: entity.name.type.instance.jsdoc + - match: '((@)(?:arg|argument|const|constant|member|namespace|param|prop|property|var))\s+(?={)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])' + pop: true + - include: jsdoctype + - match: '([A-Za-z_$][\w$.\[\]]*)' + scope: variable.other.jsdoc + - match: |- + (?x) + (\[)\s* + [\w$]+ + (?: + (?:\[\])? # Foo[ ].bar properties within an array + \. # Foo.Bar namespaced parameter + [\w$]+ + )* + (?: + \s* + (=) # [foo=bar] Default parameter value + \s* + ( + # The inner regexes are to stop the match early at */ and to not stop at escaped quotes + (?> + "(?:(?:\*(?!/))|(?:\\(?!"))|[^*\\])*?" | # [foo="bar"] Double-quoted + '(?:(?:\*(?!/))|(?:\\(?!'))|[^*\\])*?' | # [foo='bar'] Single-quoted + \[ (?:(?:\*(?!/))|[^*])*? \] | # [foo=[1,2]] Array literal + (?:(?:\*(?!/))|\s(?!\s*\])|\[.*?(?:\]|(?=\*/))|[^*\s\[\]])* # Everything else + )* + ) + )? + \s*(?:(\])((?:[^*\s]|\*[^\s/])+)?|(?=\*/)) + scope: variable.other.jsdoc + captures: + 1: punctuation.definition.optional-value.begin.bracket.square.jsdoc + 2: keyword.operator.assignment.jsdoc + 3: source.embedded.tsx + 4: punctuation.definition.optional-value.end.bracket.square.jsdoc + 5: invalid.illegal.syntax.jsdoc + - match: |- + (?x) + ( + (@) + (?:define|enum|exception|export|extends|lends|implements|modifies + |namespace|private|protected|returns?|suppress|this|throws|type + |yields?) + ) + \s+(?={) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + push: + - match: '(?=\s|\*/|[^{}\[\]A-Za-z_$])' + pop: true + - include: jsdoctype + - match: |- + (?x) + ( + (@) + (?:alias|augments|callback|constructs|emits|event|fires|exports? + |extends|external|function|func|host|lends|listens|interface|memberof!? + |method|module|mixes|mixin|name|requires|see|this|typedef|uses) + ) + \s+ + ( + (?: + [^{}@\s*] | \*[^/] + )+ + ) + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: entity.name.type.instance.jsdoc + - match: '((@)(?:default(?:value)?|license|version))\s+(([''''"]))' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + 4: punctuation.definition.string.begin.jsdoc + push: + - meta_content_scope: variable.other.jsdoc + - match: (\3)|(?=$|\*/) + captures: + 0: variable.other.jsdoc + 1: punctuation.definition.string.end.jsdoc + pop: true + - match: '((@)(?:default(?:value)?|license|tutorial|variation|version))\s+([^\s*]+)' + captures: + 1: storage.type.class.jsdoc + 2: punctuation.definition.block.tag.jsdoc + 3: variable.other.jsdoc + - match: '(?x) (@) (?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|generator|global|hideconstructor|host|ignore|implements|implicitCast|inherit[Dd]oc |inner|instance|interface|internal|kind|lends|license|listens|main|member|memberof!?|method |mixes|mixins?|modifies|module|name|namespace|noalias|nocollapse|nocompile|nosideeffects |override|overview|package|param|polymer(?:Behavior)?|preserve|private|prop|property|protected |public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary |suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation |version|virtual|writeOnce|yields?) \b' + scope: storage.type.class.jsdoc + captures: + 1: punctuation.definition.block.tag.jsdoc + - include: inline-tags + enum-declaration: + - match: '(?>=|>>>=|\|= + scope: keyword.operator.assignment.compound.bitwise.tsx + - match: "<<|>>>|>>" + scope: keyword.operator.bitwise.shift.tsx + - match: "===|!==|==|!=" + scope: keyword.operator.comparison.tsx + - match: <=|>=|<>|<|> + scope: keyword.operator.relational.tsx + - match: \!|&&|\|\| + scope: keyword.operator.logical.tsx + - match: \&|~|\^|\| + scope: keyword.operator.bitwise.tsx + - match: \= + scope: keyword.operator.assignment.tsx + - match: "--" + scope: keyword.operator.decrement.tsx + - match: \+\+ + scope: keyword.operator.increment.tsx + - match: '%|\*|/|-|\+' + scope: keyword.operator.arithmetic.tsx + - match: '(?<=[_$[:alnum:])\]])\s*(/)(?![/*])' + captures: + 1: keyword.operator.arithmetic.tsx + expressionPunctuations: + - include: punctuation-comma + - include: punctuation-accessor + expressionWithoutIdentifiers: + - include: jsx + - include: string + - include: regex + - include: template + - include: comment + - include: function-expression + - include: class-expression + - include: arrow-function + - include: paren-expression-possibly-arrow + - include: cast + - include: ternary-expression + - include: new-expr + - include: instanceof-expr + - include: object-literal + - include: expression-operators + - include: function-call + - include: literal + - include: support-objects + - include: paren-expression + field-declaration: + - match: |- + (?x)(?) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + )) | + (:\s*((<\s*$)|([\(]\s*([\{\[]\s*)?$))) | + (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + ))) + captures: + 1: meta.definition.property.tsx entity.name.function.tsx + 2: keyword.operator.optional.tsx + - match: "[_$[:alpha:]][_$[:alnum:]]*" + scope: meta.definition.property.tsx variable.object.property.tsx + - match: \? + scope: keyword.operator.optional.tsx + for-loop: + - match: '(?\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?!=)\>)*(?!=)>\s*)?\()' + push: + - match: '(?<=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(\?\.\s*)?(<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?!=)\>)*(?!=)>\s*)?\()' + pop: true + - match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))' + push: + - meta_scope: meta.function-call.tsx + - match: '(?=\s*(\?\.\s*)?(<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?!=)\>)*(?!=)>\s*)?\()' + pop: true + - include: literal + - include: support-objects + - include: object-identifiers + - include: punctuation-accessor + - match: '(?:(?) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + )) + captures: + 1: punctuation.accessor.tsx + 2: punctuation.accessor.optional.tsx + 3: entity.name.function.tsx + - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])' + captures: + 1: punctuation.accessor.tsx + 2: punctuation.accessor.optional.tsx + 3: variable.other.constant.property.tsx + - match: '(?:(\.)|(\?\.(?!\s*[[:digit:]])))\s*([_$[:alpha:]][_$[:alnum:]]*)' + captures: + 1: punctuation.accessor.tsx + 2: punctuation.accessor.optional.tsx + 3: variable.other.property.tsx + - match: "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])" + scope: variable.other.constant.tsx + - match: "[_$[:alpha:]][_$[:alnum:]]*" + scope: variable.other.readwrite.tsx + import-declaration: + - match: '(?))' + push: + - meta_scope: meta.tag.tsx + - match: '(/>)|(?:())' + captures: + 1: punctuation.definition.tag.end.tsx + 2: punctuation.definition.tag.begin.tsx + 3: entity.name.tag.namespace.tsx + 4: punctuation.separator.namespace.tsx + 5: entity.name.tag.tsx + 6: support.class.component.tsx + 7: punctuation.definition.tag.end.tsx + pop: true + - match: '(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?)' + captures: + 1: punctuation.definition.tag.begin.tsx + 2: entity.name.tag.namespace.tsx + 3: punctuation.separator.namespace.tsx + 4: entity.name.tag.tsx + 5: support.class.component.tsx + push: + - match: "(?=[/]?>)" + pop: true + - include: comment + - include: type-arguments + - include: jsx-tag-attributes + - match: (>) + captures: + 1: punctuation.definition.tag.end.tsx + push: + - meta_content_scope: meta.jsx.children.tsx + - match: (?=|/\*|//) + captures: + 1: entity.other.attribute-name.namespace.tsx + 2: punctuation.separator.namespace.tsx + 3: entity.other.attribute-name.tsx + jsx-tag-attributes: + - match: \s+ + push: + - meta_scope: meta.tag.attributes.tsx + - match: "(?=[/]?>)" + pop: true + - include: comment + - include: jsx-tag-attribute-name + - include: jsx-tag-attribute-assignment + - include: jsx-string-double-quoted + - include: jsx-string-single-quoted + - include: jsx-evaluated-code + - include: jsx-tag-attributes-illegal + jsx-tag-attributes-illegal: + - match: \S+ + scope: invalid.illegal.attribute.tsx + jsx-tag-in-expression: + - match: |- + (?x) + (?:*]|&&|\|\||\?|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^yield|[^\._$[:alnum:]]yield|^)\s* + (?!<\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s+[^=>])|,)) # look ahead is not type parameter of arrow + (?=(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?)) + push: + - match: '(?!(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?))' + pop: true + - include: jsx-tag + jsx-tag-without-attributes: + - match: '(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?)' + captures: + 1: punctuation.definition.tag.begin.tsx + 2: entity.name.tag.namespace.tsx + 3: punctuation.separator.namespace.tsx + 4: entity.name.tag.tsx + 5: support.class.component.tsx + 6: punctuation.definition.tag.end.tsx + push: + - meta_scope: meta.tag.without-attributes.tsx + - meta_content_scope: meta.jsx.children.tsx + - match: '()' + captures: + 1: punctuation.definition.tag.begin.tsx + 2: entity.name.tag.namespace.tsx + 3: punctuation.separator.namespace.tsx + 4: entity.name.tag.tsx + 5: support.class.component.tsx + 6: punctuation.definition.tag.end.tsx + pop: true + - include: jsx-children + jsx-tag-without-attributes-in-expression: + - match: '(?:*]|&&|\|\||\?|^await|[^\._$[:alnum:]]await|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^yield|[^\._$[:alnum:]]yield|^)\s*(?=(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?))' + push: + - match: '(?!(<)\s*(?:([_$[:alpha:]][-$[:alnum:].]*)(?))' + pop: true + - include: jsx-tag-without-attributes + label: + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(:)(?=\s*\{)' + captures: + 1: entity.name.label.tsx + 2: punctuation.separator.label.tsx + push: + - match: '(?<=\})' + pop: true + - include: decl-block + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(:)' + captures: + 1: entity.name.label.tsx + 2: punctuation.separator.label.tsx + literal: + - include: numeric-literal + - include: boolean-literal + - include: null-literal + - include: undefined-literal + - include: numericConstant-literal + - include: array-literal + - include: this-literal + - include: super-literal + method-declaration: + - match: '(?x)(?) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + ))) + scope: meta.object.member.tsx + captures: + 0: meta.object-literal.key.tsx + 1: entity.name.function.tsx + - match: '(?:[_$[:alpha:]][_$[:alnum:]]*)\s*(?=:)' + scope: meta.object.member.tsx + captures: + 0: meta.object-literal.key.tsx + - match: \.\.\. + captures: + 0: keyword.operator.spread.tsx + push: + - meta_scope: meta.object.member.tsx + - match: '(?=,|\})' + pop: true + - include: expression + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=,|\}|$)' + scope: meta.object.member.tsx + captures: + 1: variable.other.readwrite.tsx + - match: '(?=[_$[:alpha:]][_$[:alnum:]]*\s*=)' + push: + - meta_scope: meta.object.member.tsx + - match: '(?=,|\}|$)' + pop: true + - include: expression + - match: ":" + captures: + 0: meta.object-literal.key.tsx punctuation.separator.key-value.tsx + push: + - meta_scope: meta.object.member.tsx + - match: '(?=,|\})' + pop: true + - match: '(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)\(\s*([\{\[]\s*)?$)' + captures: + 1: storage.modifier.async.tsx + push: + - match: (?<=\)) + pop: true + - include: type-parameters + - match: \( + captures: + 0: meta.brace.round.tsx + push: + - match: \) + captures: + 0: meta.brace.round.tsx + pop: true + - include: expression-inside-possibly-arrow-parens + - match: '(?<=:)\s*(async)?\s*(\()(?=\s*([\{\[]\s*)?$)' + captures: + 1: storage.modifier.async.tsx + 2: meta.brace.round.tsx + push: + - match: \) + captures: + 0: meta.brace.round.tsx + pop: true + - include: expression-inside-possibly-arrow-parens + - include: expression + - include: punctuation-comma + parameter-array-binding-pattern: + - match: '(?:(\.\.\.)\s*)?(\[)' + captures: + 1: keyword.operator.rest.tsx + 2: punctuation.definition.binding-pattern.array.tsx + push: + - match: '\]' + captures: + 0: punctuation.definition.binding-pattern.array.tsx + pop: true + - include: parameter-binding-element + - include: punctuation-comma + parameter-binding-element: + - include: comment + - include: string + - include: parameter-object-binding-pattern + - include: parameter-array-binding-pattern + - include: destructuring-parameter-rest + - include: variable-initializer + parameter-name: + - match: '(?) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + )) | + (:\s*((<\s*$)|([\(]\s*([\{\[]\s*)?$))) | + (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + ))) + captures: + 1: storage.modifier.tsx + 2: keyword.operator.rest.tsx + 3: entity.name.function.tsx variable.language.this.tsx + 4: entity.name.function.tsx + 5: keyword.operator.optional.tsx + - match: '(?x)(?:(?]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*))?\(\s*[\{\[]\s*$)' + captures: + 1: storage.modifier.async.tsx + push: + - match: (?<=\)) + pop: true + - include: paren-expression-possibly-arrow-with-typeparameters + - match: '(?<=[(=,]|=>)\s*(async)?(?=\s*((((<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*))?\()|(<))\s*$)' + captures: + 1: storage.modifier.async.tsx + push: + - match: (?<=\)) + pop: true + - include: paren-expression-possibly-arrow-with-typeparameters + - include: possibly-arrow-return-type + paren-expression-possibly-arrow-with-typeparameters: + - include: type-parameters + - match: \( + captures: + 0: meta.brace.round.tsx + push: + - match: \) + captures: + 0: meta.brace.round.tsx + pop: true + - include: expression-inside-possibly-arrow-parens + possibly-arrow-return-type: + - match: '(?<=\))\s*(:)(?=\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+\s*=>)' + captures: + 1: meta.arrow.tsx meta.return.type.arrow.tsx keyword.operator.type.annotation.tsx + push: + - meta_content_scope: meta.arrow.tsx meta.return.type.arrow.tsx + - match: '(?==>|\{|(^\s*(export|function|class|interface|let|var|const|import|enum|namespace|module|type|abstract|declare)\s+))' + pop: true + - include: arrow-return-type-body + property-accessor: + - match: '(?|&&|\|\||\*\/)\s*(\/)(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/[gimsuy]*(?!\s*[a-zA-Z0-9_$]))' + captures: + 1: punctuation.definition.string.begin.tsx + push: + - meta_scope: string.regexp.tsx + - match: "(/)([gimsuy]*)" + captures: + 1: punctuation.definition.string.end.tsx + 2: keyword.other.tsx + pop: true + - include: regexp + - match: '(?' + captures: + 0: keyword.other.back-reference.regexp + 1: variable.other.regexp + - match: '[?+*]|\{(\d+,\d+|\d+,|,\d+|\d+)\}\??' + scope: keyword.operator.quantifier.regexp + - match: \| + scope: keyword.operator.or.regexp + - match: (\()((\?=)|(\?!)|(\?<=)|(\?))?' + captures: + 0: punctuation.definition.group.regexp + 1: punctuation.definition.group.no-capture.regexp + 2: variable.other.regexp + push: + - meta_scope: meta.group.regexp + - match: \) + captures: + 0: punctuation.definition.group.regexp + pop: true + - include: regexp + - match: '(\[)(\^)?' + captures: + 1: punctuation.definition.character-class.regexp + 2: keyword.operator.negation.regexp + push: + - meta_scope: constant.other.character-class.set.regexp + - match: '(\])' + captures: + 1: punctuation.definition.character-class.regexp + pop: true + - match: '(?:.|(\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\c[A-Z])|(\\.))\-(?:[^\]\\]|(\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\c[A-Z])|(\\.))' + scope: constant.other.character-class.range.regexp + captures: + 1: constant.character.numeric.regexp + 2: constant.character.control.regexp + 3: constant.character.escape.backslash.regexp + 4: constant.character.numeric.regexp + 5: constant.character.control.regexp + 6: constant.character.escape.backslash.regexp + - include: regex-character-class + - include: regex-character-class + return-type: + - match: (?<=\))\s*(:)(?=\s*\S) + captures: + 1: keyword.operator.type.annotation.tsx + push: + - meta_scope: meta.return.type.tsx + - match: "(?]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)?\() + captures: + 1: punctuation.accessor.tsx + 2: punctuation.accessor.optional.tsx + 3: support.constant.dom.tsx + 4: support.variable.property.dom.tsx + - match: |- + (?x)(?\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[=]|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?!=)\>)*(?!=)>\s*)`)' + captures: + 1: entity.name.function.tagged-template.tsx + push: + - meta_scope: string.template.tsx + - match: (?=`) + pop: true + - include: type-arguments + - match: "([_$[:alpha:]][_$[:alnum:]]*)?(`)" + captures: + 1: entity.name.function.tagged-template.tsx + 2: punctuation.definition.string.template.begin.tsx + push: + - meta_scope: string.template.tsx + - match: "`" + captures: + 0: punctuation.definition.string.template.end.tsx + pop: true + - include: template-substitution-element + - include: string-character-escape + template-substitution-element: + - match: '\$\{' + captures: + 0: punctuation.definition.template-expression.begin.tsx + push: + - meta_scope: meta.template.expression.tsx + - meta_content_scope: meta.embedded.line.tsx + - match: '\}' + captures: + 0: punctuation.definition.template-expression.end.tsx + pop: true + - include: expression + ternary-expression: + - match: '(?!\?\.\s*[^[:digit:]])(\?)' + captures: + 1: keyword.operator.ternary.tsx + push: + - match: \s*(:) + captures: + 1: keyword.operator.ternary.tsx + pop: true + - include: expression + this-literal: + - match: '(?])|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)))' + pop: true + - include: type + - match: (:) + captures: + 1: keyword.operator.type.annotation.tsx + push: + - meta_scope: meta.type.annotation.tsx + - match: '(?])|(?=^\s*$)|((?<=\S)(?=\s*$))|((?<=[\}>\]\)]|[_$[:alpha:]])\s*(?=\{)))' + pop: true + - include: type + type-arguments: + - match: \< + captures: + 0: punctuation.definition.typeparameters.begin.tsx + push: + - meta_scope: meta.type.parameters.tsx + - match: \> + captures: + 0: punctuation.definition.typeparameters.end.tsx + pop: true + - include: type + - include: punctuation-comma + type-builtin-literals: + - match: '(?) + )) + ) + ) + ) + push: + - meta_scope: meta.type.function.tsx + - match: (?<=\)) + pop: true + - include: function-parameters + type-function-return-type: + - match: (=>)(?=\s*\S) + captures: + 1: storage.type.function.arrow.tsx + push: + - meta_scope: meta.type.function.return.tsx + - match: '(?)(?:\?]|//|$)' + pop: true + - include: type-function-return-type-core + - match: "=>" + captures: + 0: storage.type.function.arrow.tsx + push: + - meta_scope: meta.type.function.return.tsx + - match: '(?)(?]|//|^\s*$)|((?<=\S)(?=\s*$)))' + pop: true + - include: type-function-return-type-core + type-function-return-type-core: + - include: comment + - match: '(?<==>)(?=\s*\{)' + push: + - match: '(?<=\})' + pop: true + - include: type-object + - include: type-predicate-operator + - include: type + type-name: + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))' + captures: + 1: entity.name.type.module.tsx + 2: punctuation.accessor.tsx + 3: punctuation.accessor.optional.tsx + - match: "[_$[:alpha:]][_$[:alnum:]]*" + scope: entity.name.type.tsx + type-object: + - match: '\{' + captures: + 0: punctuation.definition.block.tsx + push: + - meta_scope: meta.object.type.tsx + - match: '\}' + captures: + 0: punctuation.definition.block.tsx + pop: true + - include: comment + - include: method-declaration + - include: indexer-declaration + - include: indexer-mapped-type-declaration + - include: field-declaration + - include: type-annotation + - match: \.\.\. + captures: + 0: keyword.operator.spread.tsx + push: + - match: '(?=\}|;|,|$)|(?<=\})' + pop: true + - include: type + - include: punctuation-comma + - include: punctuation-semicolon + - include: type + type-operators: + - include: typeof-operator + - match: '(?:([&|])|(=(?!>)))(?=\s*\{)' + captures: + 1: keyword.operator.type.tsx + 2: keyword.operator.assignment.tsx + push: + - match: '(?<=\})' + pop: true + - include: type-object + - match: "([&|])|(=(?!>))" + captures: + 1: keyword.operator.type.tsx + 2: keyword.operator.assignment.tsx + push: + - match: (?=\S) + pop: true + - match: '(?) + captures: + 1: punctuation.definition.typeparameters.end.tsx + pop: true + - include: comment + - match: '(?) + )) + )) + )) | + (:\s*((<\s*$)|([\(]\s*([\{\[]\s*)?$)))) + captures: + 1: storage.modifier.tsx + 2: keyword.operator.rest.tsx + 3: entity.name.function.tsx variable.language.this.tsx + 4: entity.name.function.tsx + 5: keyword.operator.optional.tsx + - match: '(?x)(?:(?) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + )) | + (:\s*((<\s*$)|([\(]\s*([\{\[]\s*)?$))) | + (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + ))) + captures: + 1: meta.definition.variable.tsx variable.other.constant.tsx entity.name.function.tsx + push: + - meta_scope: meta.var-single-variable.expr.tsx + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' + pop: true + - include: var-single-variable-type-annotation + - match: "([_$[:alpha:]][_$[:alnum:]]*)" + captures: + 1: meta.definition.variable.tsx variable.other.constant.tsx + push: + - meta_scope: meta.var-single-variable.expr.tsx + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' + pop: true + - include: var-single-variable-type-annotation + var-single-variable: + - match: |- + (?x)([_$[:alpha:]][_$[:alnum:]]*)(?=\s* + # function assignment | + (=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + )) | + # typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) => + (:\s*( + (<) | + ([(]\s*( + ([)]) | + (\.\.\.) | + ([_$[:alnum:]]+\s*( + ([:,?=])| + ([)]\s*=>) + )) + )) + )) | + (:\s*((<\s*$)|([\(]\s*([\{\[]\s*)?$))) | + (:\s*(=>|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(<[^<>]*>)|[^<>(),=])+=\s*( + ((async\s+)?( + (function\s*[(<*]) | + (function\s+) | + ([_$[:alpha:]][_$[:alnum:]]*\s*=>) + )) | + ((async\s*)?( + ((<\s*$)|([\(]\s*([\{\[]\s*)?$)) | + # sure shot arrow functions even if => is on new line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? + [(]\s* + ( + ([)]\s*:) | # (): + ((\.\.\.\s*)?[_$[:alpha:]][_$[:alnum:]]*\s*:) # [(]param: | [(]...param: + ) + ) | + ( + [<]\s*[_$[:alpha:]][_$[:alnum:]]*\s+extends\s*[^=>] # < typeparam extends + ) | + # arrow function possible to detect only with => on same line + ( + (<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)? # typeparameters + \(\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters + (\s*:\s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+)? # return type + \s*=> # arrow operator + ) + )) + ))) + captures: + 1: meta.definition.variable.tsx entity.name.function.tsx + push: + - meta_scope: meta.var-single-variable.expr.tsx + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' + pop: true + - include: var-single-variable-type-annotation + - match: "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])" + captures: + 1: meta.definition.variable.tsx variable.other.constant.tsx + push: + - meta_scope: meta.var-single-variable.expr.tsx + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' + pop: true + - include: var-single-variable-type-annotation + - match: "([_$[:alpha:]][_$[:alnum:]]*)" + captures: + 1: meta.definition.variable.tsx variable.other.readwrite.tsx + push: + - meta_scope: meta.var-single-variable.expr.tsx + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' + pop: true + - include: var-single-variable-type-annotation + var-single-variable-type-annotation: + - include: type-annotation + - include: string + - include: comment + variable-initializer: + - match: (?