diff options
-rw-r--r-- | .gitmodules | 12 | ||||
m--------- | assets/syntaxes/Elm | 0 | ||||
m--------- | assets/syntaxes/Kotlin | 0 | ||||
-rw-r--r-- | assets/syntaxes/Kotlin.sublime-syntax | 398 | ||||
m--------- | assets/syntaxes/Puppet | 0 | ||||
m--------- | assets/syntaxes/TypeScript | 0 | ||||
-rw-r--r-- | assets/syntaxes/TypeScript.sublime-syntax | 3027 |
7 files changed, 3437 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules index dcd9a58e..91a88711 100644 --- a/.gitmodules +++ b/.gitmodules @@ -49,3 +49,15 @@ [submodule "assets/themes/zenburn"] path = assets/themes/zenburn url = https://github.com/colinta/zenburn.git +[submodule "assets/syntaxes/Kotlin"] + path = assets/syntaxes/Kotlin + url = https://github.com/vkostyukov/kotlin-sublime-package +[submodule "assets/syntaxes/Elm"] + path = assets/syntaxes/Elm + url = https://github.com/elm-community/SublimeElmLanguageSupport +[submodule "assets/syntaxes/TypeScript"] + path = assets/syntaxes/TypeScript + url = https://github.com/Microsoft/TypeScript-Sublime-Plugin +[submodule "assets/syntaxes/Puppet"] + path = assets/syntaxes/Puppet + url = https://github.com/russCloak/SublimePuppet diff --git a/assets/syntaxes/Elm b/assets/syntaxes/Elm new file mode 160000 +Subproject dfbb8bdc9a8403092c884d3eb893a270538cfa7 diff --git a/assets/syntaxes/Kotlin b/assets/syntaxes/Kotlin new file mode 160000 +Subproject aeeed2780b04aea3d293c547c24cae27cafef0c diff --git a/assets/syntaxes/Kotlin.sublime-syntax b/assets/syntaxes/Kotlin.sublime-syntax new file mode 100644 index 00000000..eab59192 --- /dev/null +++ b/assets/syntaxes/Kotlin.sublime-syntax @@ -0,0 +1,398 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: Kotlin +file_extensions: + - kt + - kts +scope: source.Kotlin +contexts: + main: + - include: comments + - match: '^\s*(package)\b(?:\s*([^ ;$]+)\s*)?' + captures: + 1: keyword.other.kotlin + 2: entity.name.package.kotlin + - include: imports + - include: statements + classes: + - match: (?<!::)(?=\b(?:companion|class|object|interface)\b) + push: + - match: '(?=$|\})' + pop: true + - include: comments + - match: \b(companion\s*)?(class|object|interface)\b + captures: + 1: storage.modifier.kotlin + 2: storage.modifier.kotlin + push: + - match: '(?=<|\{|\(|:|$)' + pop: true + - include: comments + - match: \w+ + scope: entity.name.type.class.kotlin + - match: < + push: + - match: ">" + pop: true + - include: generics + - match: \( + push: + - match: \) + pop: true + - include: parameters + - match: (:) + captures: + 1: keyword.operator.declaration.kotlin + push: + - match: "(?={|$)" + pop: true + - match: \w+ + scope: entity.other.inherited-class.kotlin + - match: \( + push: + - match: \) + pop: true + - include: expressions + - match: '\{' + push: + - match: '\}' + pop: true + - include: statements + comments: + - match: /\* + captures: + 0: punctuation.definition.comment.kotlin + push: + - meta_scope: comment.block.kotlin + - match: \*/ + captures: + 0: punctuation.definition.comment.kotlin + pop: true + - match: \s*((//).*$\n?) + captures: + 1: comment.line.double-slash.kotlin + 2: punctuation.definition.comment.kotlin + constants: + - match: \b(true|false|null|this|super)\b + scope: constant.language.kotlin + - match: '\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)([LlFf])?\b' + scope: constant.numeric.kotlin + - match: '\b([A-Z][A-Z0-9_]+)\b' + scope: constant.other.kotlin + expressions: + - match: \( + push: + - match: \) + pop: true + - include: expressions + - include: types + - include: strings + - include: constants + - include: comments + - include: keywords + functions: + - match: (?=\s*\b(?:fun)\b) + push: + - match: '(?=$|\})' + pop: true + - match: \b(fun)\b + captures: + 1: keyword.other.kotlin + push: + - match: (?=\() + pop: true + - match: < + push: + - match: ">" + pop: true + - include: generics + - match: '([\.<\?>\w]+\.)?(\w+)' + captures: + 2: entity.name.function.kotlin + - match: \( + push: + - match: \) + pop: true + - include: parameters + - match: (:) + captures: + 1: keyword.operator.declaration.kotlin + push: + - match: "(?={|=|$)" + pop: true + - include: types + - match: '\{' + push: + - match: '(?=\})' + pop: true + - include: statements + - match: (=) + captures: + 1: keyword.operator.assignment.kotlin + push: + - match: (?=$) + pop: true + - include: expressions + generics: + - match: (:) + captures: + 1: keyword.operator.declaration.kotlin + push: + - match: (?=,|>) + pop: true + - include: types + - include: keywords + - match: \w+ + scope: storage.type.generic.kotlin + getters-and-setters: + - match: \b(get)\b\s*\(\s*\) + captures: + 1: entity.name.function.kotlin + push: + - match: '\}|(?=\bset\b)|$' + pop: true + - match: (=) + captures: + 1: keyword.operator.assignment.kotlin + push: + - match: (?=$|\bset\b) + pop: true + - include: expressions + - match: '\{' + push: + - match: '\}' + pop: true + - include: expressions + - match: \b(set)\b\s*(?=\() + captures: + 1: entity.name.function.kotlin + push: + - match: '\}|(?=\bget\b)|$' + pop: true + - match: \( + push: + - match: \) + pop: true + - include: parameters + - match: (=) + captures: + 1: keyword.operator.assignment.kotlin + push: + - match: (?=$|\bset\b) + pop: true + - include: expressions + - match: '\{' + push: + - match: '\}' + pop: true + - include: expressions + imports: + - match: '^\s*(import)\s+[^ $]+\s+(as)?' + captures: + 1: keyword.other.kotlin + 2: keyword.other.kotlin + keywords: + - match: \b(var|val|public|private|protected|abstract|final|sealed|enum|open|attribute|annotation|override|inline|vararg|in|out|internal|data|tailrec|operator|infix|const|yield|typealias|typeof|reified|suspend)\b + scope: storage.modifier.kotlin + - match: \b(try|catch|finally|throw)\b + scope: keyword.control.catch-exception.kotlin + - match: \b(if|else|while|for|do|return|when|where|break|continue)\b + scope: keyword.control.kotlin + - match: \b(in|is|!in|!is|as|as\?|assert)\b + scope: keyword.operator.kotlin + - match: (==|!=|===|!==|<=|>=|<|>) + scope: keyword.operator.comparison.kotlin + - match: (=) + scope: keyword.operator.assignment.kotlin + - match: (::) + scope: keyword.operator.kotlin + - match: (:) + scope: keyword.operator.declaration.kotlin + - match: \b(by)\b + scope: keyword.other.by.kotlin + - match: (\?\.) + scope: keyword.operator.safenav.kotlin + - match: (\.) + scope: keyword.operator.dot.kotlin + - match: (\?:) + scope: keyword.operator.elvis.kotlin + - match: (\-\-|\+\+) + scope: keyword.operator.increment-decrement.kotlin + - match: (\+=|\-=|\*=|\/=) + scope: keyword.operator.arithmetic.assign.kotlin + - match: (\.\.) + scope: keyword.operator.range.kotlin + - match: (\-|\+|\*|\/|%) + scope: keyword.operator.arithmetic.kotlin + - match: (!|&&|\|\|) + scope: keyword.operator.logical.kotlin + - match: (;) + scope: punctuation.terminator.kotlin + namespaces: + - match: \b(namespace)\b + scope: keyword.other.kotlin + - match: '\{' + push: + - match: '\}' + pop: true + - include: statements + parameters: + - match: (:) + captures: + 1: keyword.operator.declaration.kotlin + push: + - match: (?=,|\)|=) + pop: true + - include: types + - match: (=) + captures: + 1: keyword.operator.declaration.kotlin + push: + - match: (?=,|\)) + pop: true + - include: expressions + - include: keywords + - match: \w+ + scope: variable.parameter.function.kotlin + statements: + - include: namespaces + - include: typedefs + - include: classes + - include: functions + - include: variables + - include: getters-and-setters + - include: expressions + strings: + - match: '"""' + captures: + 0: punctuation.definition.string.begin.kotlin + push: + - meta_scope: string.quoted.third.kotlin + - match: '"""' + captures: + 0: punctuation.definition.string.end.kotlin + pop: true + - match: '(\$\w+|\$\{[^\}]+\})' + scope: variable.parameter.template.kotlin + - match: \\. + scope: constant.character.escape.kotlin + - match: '"' + captures: + 0: punctuation.definition.string.begin.kotlin + push: + - meta_scope: string.quoted.double.kotlin + - match: '"' + captures: + 0: punctuation.definition.string.end.kotlin + pop: true + - match: '(\$\w+|\$\{[^\}]+\})' + scope: variable.parameter.template.kotlin + - match: \\. + scope: constant.character.escape.kotlin + - match: "'" + captures: + 0: punctuation.definition.string.begin.kotlin + push: + - meta_scope: string.quoted.single.kotlin + - match: "'" + captures: + 0: punctuation.definition.string.end.kotlin + pop: true + - match: \\. + scope: constant.character.escape.kotlin + - match: "`" + captures: + 0: punctuation.definition.string.begin.kotlin + push: + - meta_scope: string.quoted.single.kotlin + - match: "`" + captures: + 0: punctuation.definition.string.end.kotlin + pop: true + typedefs: + - match: (?=\s*(?:type)) + push: + - match: (?=$) + pop: true + - match: \b(type)\b + scope: keyword.other.kotlin + - match: < + push: + - match: ">" + pop: true + - include: generics + - include: expressions + types: + - match: \b(Nothing|Any|Unit|String|CharSequence|Int|Boolean|Char|Long|Double|Float|Short|Byte|dynamic)\b + scope: storage.type.buildin.kotlin + - match: \b(IntArray|BooleanArray|CharArray|LongArray|DoubleArray|FloatArray|ShortArray|ByteArray)\b + scope: storage.type.buildin.array.kotlin + - match: \b(Array|Collection|List|Map|Set|MutableList|MutableMap|MutableSet|Sequence)<\b + captures: + 1: storage.type.buildin.collection.kotlin + push: + - match: ">" + pop: true + - include: types + - include: keywords + - match: \w+< + push: + - match: ">" + pop: true + - include: types + - include: keywords + - match: '\{' + push: + - match: '\}' + pop: true + - include: statements + - match: \( + push: + - match: \) + pop: true + - include: types + - match: (->) + scope: keyword.operator.declaration.kotlin + variables: + - match: (?=\s*\b(?:var|val)\b) + push: + - match: (?=:|=|(\b(by)\b)|$) + pop: true + - match: \b(var|val)\b + captures: + 1: keyword.other.kotlin + push: + - match: (?=:|=|(\b(by)\b)|$) + pop: true + - match: < + push: + - match: ">" + pop: true + - include: generics + - match: '([\.<\?>\w]+\.)?(\w+)' + captures: + 2: entity.name.variable.kotlin + - match: (:) + captures: + 1: keyword.operator.declaration.kotlin + push: + - match: (?==|$) + pop: true + - include: types + - include: getters-and-setters + - match: \b(by)\b + captures: + 1: keyword.other.kotlin + push: + - match: (?=$) + pop: true + - include: expressions + - match: (=) + captures: + 1: keyword.operator.assignment.kotlin + push: + - match: (?=$) + pop: true + - include: expressions + - include: getters-and-setters diff --git a/assets/syntaxes/Puppet b/assets/syntaxes/Puppet new file mode 160000 +Subproject 2a224343d2151b2896b6d9c48343919c06d1e69 diff --git a/assets/syntaxes/TypeScript b/assets/syntaxes/TypeScript new file mode 160000 +Subproject 19a599ad0e2edfb13c107db4305cf07b82cdc02 diff --git a/assets/syntaxes/TypeScript.sublime-syntax b/assets/syntaxes/TypeScript.sublime-syntax new file mode 100644 index 00000000..75a6c2a3 --- /dev/null +++ b/assets/syntaxes/TypeScript.sublime-syntax @@ -0,0 +1,3027 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: TypeScript +file_extensions: + - ts +scope: source.ts +contexts: + main: + - include: directives + - include: statements + - match: \A(#!).*(?=$) + scope: comment.line.shebang.ts + captures: + 1: punctuation.definition.comment.ts + comment: + - match: /\*\*(?!/) + captures: + 0: punctuation.definition.comment.ts + push: + - meta_scope: comment.block.documentation.ts + - match: \*/ + captures: + 0: punctuation.definition.comment.ts + pop: true + - include: docblock + - match: (/\*)(?:\s*((@)internal)(?=\s|(\*/)))? + captures: + 1: punctuation.definition.comment.ts + 2: storage.type.internaldeclaration.ts + 3: punctuation.decorator.internaldeclaration.ts + push: + - meta_scope: comment.block.ts + - match: \*/ + captures: + 0: punctuation.definition.comment.ts + pop: true + - match: '(^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?)' + captures: + 1: punctuation.whitespace.comment.leading.ts + 2: comment.line.double-slash.ts + 3: punctuation.definition.comment.ts + 4: storage.type.internaldeclaration.ts + 5: punctuation.decorator.internaldeclaration.ts + push: + - meta_content_scope: comment.line.double-slash.ts + - match: (?=^) + pop: true + access-modifier: + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(abstract|public|protected|private|readonly|static)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: storage.modifier.ts + after-operator-block-as-object-literal: + - 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.ts + push: + - meta_scope: meta.objectliteral.ts + - match: '\}' + captures: + 0: punctuation.definition.block.ts + pop: true + - include: object-member + array-binding-pattern: + - match: '(?:(\.\.\.)\s*)?(\[)' + captures: + 1: keyword.operator.rest.ts + 2: punctuation.definition.binding-pattern.array.ts + push: + - match: '\]' + captures: + 0: punctuation.definition.binding-pattern.array.ts + pop: true + - include: binding-element + - include: punctuation-comma + array-binding-pattern-const: + - match: '(?:(\.\.\.)\s*)?(\[)' + captures: + 1: keyword.operator.rest.ts + 2: punctuation.definition.binding-pattern.array.ts + push: + - match: '\]' + captures: + 0: punctuation.definition.binding-pattern.array.ts + pop: true + - include: binding-element-const + - include: punctuation-comma + array-literal: + - match: '\s*(\[)' + captures: + 1: meta.brace.square.ts + push: + - meta_scope: meta.array.literal.ts + - match: '\]' + captures: + 0: meta.brace.square.ts + pop: true + - include: expression + - include: punctuation-comma + arrow-function: + - match: '(?:(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(\basync)\s+)?([_$[:alpha:]][_$[:alnum:]]*)\s*(?==>)' + scope: meta.arrow.ts + captures: + 1: storage.modifier.async.ts + 2: variable.parameter.ts + - match: |- + (?x) (?: + (?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(\basync) + )? ((?<![})!\]])\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.async.ts + push: + - meta_scope: meta.arrow.ts + - 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.ts + push: + - meta_scope: meta.arrow.ts + - match: '(?<=\}|\S)(?<!=>)|((?!\{)(?=\S))' + pop: true + - include: decl-block + - include: expression + arrow-return-type: + - match: (?<=\))\s*(:) + captures: + 1: keyword.operator.type.annotation.ts + push: + - meta_scope: meta.return.type.arrow.ts + - 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: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(async)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: storage.modifier.async.ts + binding-element: + - include: comment + - include: string + - include: object-binding-pattern + - include: array-binding-pattern + - include: destructuring-variable-rest + - include: variable-initializer + binding-element-const: + - include: comment + - include: string + - include: object-binding-pattern-const + - include: array-binding-pattern-const + - include: destructuring-variable-rest-const + - include: variable-initializer + boolean-literal: + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))true(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: constant.language.boolean.true.ts + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))false(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: constant.language.boolean.false.ts + brackets: + - match: "{" + push: + - match: '}|(?=\*/)' + pop: true + - include: brackets + - match: '\[' + push: + - match: '\]|(?=\*/)' + pop: true + - include: brackets + cast: + - match: '(?:(?<!\+\+|--)(?<=^return|[^\._$[:alnum:]]return|^throw|[^\._$[:alnum:]]throw|^yield|[^\._$[:alnum:]]yield|^await|[^\._$[:alnum:]]await|^default|[^\._$[:alnum:]]default|[=(,:>*?\&\|\^]|[^_$[:alnum:]](?:\+\+|\-\-)|[^\+]\+|[^\-]\-))\s*(<)(?!<?\=)(?!\s*$)' + captures: + 1: meta.brace.angle.ts + push: + - meta_scope: cast.expr.ts + - match: (\>)\s* + captures: + 1: meta.brace.angle.ts + pop: true + - include: type + - match: '(?:(?<=^))\s*(<)(?=[_$[:alpha:]][_$[:alnum:]]*\s*>)' + captures: + 1: meta.brace.angle.ts + push: + - meta_scope: cast.expr.ts + - match: (\>)\s* + captures: + 1: meta.brace.angle.ts + pop: true + - include: type + class-declaration: + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(export)\s+)?\b(?:(abstract)\s+)?\b(class)\b(?=\s+|/[/*])' + captures: + 1: keyword.control.export.ts + 2: storage.modifier.ts + 3: storage.type.class.ts + push: + - meta_scope: meta.class.ts + - match: '(?<=\})' + pop: true + - include: class-declaration-or-expression-patterns + class-declaration-or-expression-patterns: + - include: comment + - include: class-or-interface-heritage + - match: "[_$[:alpha:]][_$[:alnum:]]*" + captures: + 0: entity.name.type.class.ts + - include: type-parameters + - include: class-or-interface-body + class-expression: + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(class)\b(?=\s+|[<{]|\/[\/*])' + captures: + 1: storage.type.class.ts + push: + - meta_scope: meta.class.ts + - match: '(?<=\})' + pop: true + - include: class-declaration-or-expression-patterns + class-or-interface-body: + - match: '\{' + captures: + 0: punctuation.definition.block.ts + push: + - match: '\}' + captures: + 0: punctuation.definition.block.ts + pop: true + - include: comment + - include: decorator + - include: method-declaration + - include: indexer-declaration + - include: field-declaration + - include: string + - include: type-annotation + - include: variable-initializer + - include: access-modifier + - include: property-accessor + - include: async-modifier + - include: after-operator-block-as-object-literal + - include: decl-block + - include: expression + - include: punctuation-comma + - include: punctuation-semicolon + class-or-interface-heritage: + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:\b(extends|implements)\b)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + captures: + 1: storage.modifier.ts + push: + - match: '(?=\{)' + pop: true + - include: comment + - include: class-or-interface-heritage + - include: type-parameters + - include: expressionWithoutIdentifiers + - match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?:(\.)|(\?\.(?!\s*[[:digit:]])))(?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s*\??\.\s*[_$[:alpha:]][_$[:alnum:]]*)*\s*)' + captures: + 1: entity.name.type.module.ts + 2: punctuation.accessor.ts + 3: punctuation.accessor.optional.ts + - match: "([_$[:alpha:]][_$[:alnum:]]*)" + captures: + 1: entity.other.inherited-class.ts + - include: expressionPunctuations + control-statement: + - include: switch-statement + - include: for-loop + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(catch|finally|throw|try)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: keyword.control.trycatch.ts + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|goto)\s+([_$[:alpha:]][_$[:alnum:]]*)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + captures: + 1: keyword.control.loop.ts + 2: entity.name.label.ts + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(break|continue|do|goto|while)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: keyword.control.loop.ts + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(return)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: keyword.control.flow.ts + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(case|default|switch)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: keyword.control.switch.ts + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(else|if)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: keyword.control.conditional.ts + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(with)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: keyword.control.with.ts + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(package)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: keyword.control.ts + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(debugger)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: keyword.other.debugger.ts + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(declare)(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))' + scope: storage.modifier.ts + decl-block: + - match: '\{' + captures: + 0: punctuation.definition.block.ts + push: + - meta_scope: meta.block.ts + - match: '\}' + captures: + 0: punctuation.definition.block.ts + pop: true + - include: statements + declaration: + - include: decorator + - include: var-expr + - include: function-declaration + - include: class-declaration + - include: interface-declaration + - include: enum-declaration + - include: namespace-declaration + - include: type-alias-declaration + - include: import-equals-declaration + - include: import-declaration + - include: export-declaration + decorator: + - match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))\@' + captures: + 0: punctuation.decorator.ts + push: + - meta_scope: meta.decorator.ts + - match: (?=\s) + pop: true + - include: expression + destructuring-const: + - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\{)' + push: + - meta_scope: meta.object-binding-pattern-variable.ts + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' + pop: true + - include: object-binding-pattern-const + - include: type-annotation + - include: comment + - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\[)' + push: + - meta_scope: meta.array-binding-pattern-variable.ts + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' + pop: true + - include: array-binding-pattern-const + - include: type-annotation + - include: comment + destructuring-parameter: + - match: '(?<!=|:)\s*(\{)' + captures: + 1: punctuation.definition.binding-pattern.object.ts + push: + - meta_scope: meta.parameter.object-binding-pattern.ts + - match: '\}' + captures: + 0: punctuation.definition.binding-pattern.object.ts + pop: true + - include: parameter-object-binding-element + - match: '(?<!=|:)\s*(\[)' + captures: + 1: punctuation.definition.binding-pattern.array.ts + push: + - meta_scope: meta.paramter.array-binding-pattern.ts + - match: '\]' + captures: + 0: punctuation.definition.binding-pattern.array.ts + pop: true + - include: parameter-binding-element + - include: punctuation-comma + destructuring-parameter-rest: + - match: '(?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*)' + captures: + 1: keyword.operator.rest.ts + 2: variable.parameter.ts + destructuring-variable: + - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\{)' + push: + - meta_scope: meta.object-binding-pattern-variable.ts + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' + pop: true + - include: object-binding-pattern + - include: type-annotation + - include: comment + - match: '(?<!=|:|^of|[^\._$[:alnum:]]of|^in|[^\._$[:alnum:]]in)\s*(?=\[)' + push: + - meta_scope: meta.array-binding-pattern-variable.ts + - match: '(?=$|^|[;,=}]|(\s+(of|in)\s+))' + pop: true + - include: array-binding-pattern + - include: type-annotation + - include: comment + destructuring-variable-rest: + - match: '(?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*)' + captures: + 1: keyword.operator.rest.ts + 2: meta.definition.variable.ts variable.other.readwrite.ts + destructuring-variable-rest-const: + - match: '(?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*)' + captures: + 1: keyword.operator.rest.ts + 2: meta.definition.variable.ts variable.other.constant.ts + directives: + - match: '^(///)\s*(?=<(reference|amd-dependency|amd-module)(\s+(path|types|no-default-lib|lib|name)\s*=\s*((\''([^\''\\]|\\\''|\\)*\'')|(\"([^\"\\]|\\\"|\\)*\")))+\s*/>\s*$)' + captures: + 1: punctuation.definition.comment.ts + push: + - meta_scope: comment.line.triple-slash.directive.ts + - match: (?=^) + pop: true + - match: (<)(reference|amd-dependency|amd-module) + captures: + 1: punctuation.definition.tag.directive.ts + 2: entity.name.tag.directive.ts + push: + - meta_scope: meta.tag.ts + - match: /> + captures: + 0: punctuation.definition.tag.directive.ts + pop: true + - match: path|types|no-default-lib|lib|name + scope: entity.other.attribute-name.directive.ts + - match: "=" + scope: keyword.operator.assignment.ts + - 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*/]|\*[^/])+) # <that namepath> + \s+ (as) \s+ # as + ((?:[^@\s*/]|\*[^/])+) # <this namepath> + 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: (</)caption(>)|(?=\*/) + 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.ts + - 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 + |