diff --git a/JavaScript/TypeScript.sublime-syntax b/JavaScript/TypeScript.sublime-syntax index 815123b5cf..89b517d067 100644 --- a/JavaScript/TypeScript.sublime-syntax +++ b/JavaScript/TypeScript.sublime-syntax @@ -935,26 +935,27 @@ contexts: - ts-type-tuple-possible-member-label ts-type-tuple-possible-member-label: - - match: (?={{identifier_name}}) + - match: '' branch_point: ts-type-tuple-member-label branch: - ts-type-tuple-member-label - immediately-pop pop: 1 - - include: else-pop ts-type-tuple-member-label: - - match: '' + - match: '{{identifier_name}}' + scope: variable.other.member.js set: - - - match: ':' - scope: punctuation.separator.type.js - pop: 1 - - match: (?=\S) - fail: ts-type-tuple-member-label + - ts-type-tuple-member-label-separator - ts-type-annotation-optional - - - match: '{{identifier_name}}' - scope: meta.mapping.key.js - pop: 1 + - include: else-pop + + ts-type-tuple-member-label-separator: + - match: ':' + scope: punctuation.separator.type.js + pop: 1 + - match: (?=\S) + fail: ts-type-tuple-member-label ts-type-tuple-spread: - match: \.\.\. diff --git a/JavaScript/tests/syntax_test_typescript.ts b/JavaScript/tests/syntax_test_typescript.ts index 9fb0b32722..bfbb31df30 100644 --- a/JavaScript/tests/syntax_test_typescript.ts +++ b/JavaScript/tests/syntax_test_typescript.ts @@ -860,11 +860,11 @@ let x: [ first: any, rest: ...any ]; // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.type // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence // ^ punctuation.section.sequence.begin -// ^^^^^ meta.mapping.key +// ^^^^^ variable.other.member // ^ punctuation.separator.type // ^^^ support.type.any // ^ punctuation.separator.comma -// ^^^^ meta.mapping.key +// ^^^^ variable.other.member // ^ punctuation.separator.type // ^^^ keyword.operator.spread // ^^^ support.type.any @@ -873,7 +873,7 @@ let x: [ first: any, rest: ...any ]; let x: [ typeof -// ^^^^^ meta.mapping.key +// ^^^^^ variable.other.member ? // ^ storage.modifier.optional :