diff --git a/TypeScript.YAML-tmLanguage b/TypeScript.YAML-tmLanguage index 5ea5d573..819a3feb 100644 --- a/TypeScript.YAML-tmLanguage +++ b/TypeScript.YAML-tmLanguage @@ -37,13 +37,13 @@ repository: end: (?=$|[;,]) patterns: - include: '#ternary-operator' - - include: '#expression-type' + - include: '#expression-type' ternary-operator: begin: (\?) end: (:) patterns: - - include: '#expression-type' + - include: '#expression-type' expression-type: name: meta.expression.ts @@ -63,7 +63,7 @@ repository: - include: '#logic-operator' - include: '#assignment-operator' - include: '#type-primitive' - - include: '#function-call' + - include: '#function-call' control-statement: name: keyword.control.ts @@ -307,7 +307,7 @@ repository: type-annotation: name: meta.type.annotation.ts begin: ":" - end: (?=$|[,);\}\]]|//)|(?==[^>])|(?<=[\}>\]\)]|[a-zA-Z_$])\s*(?=\{) + end: (?=$|[,);\}\]]|//)|(?==[^>])|(?<=[\}>\]\)]|[\w$])\s*(?=\{) patterns: - include: '#expression-operator' - include: '#type' diff --git a/TypeScript.tmLanguage b/TypeScript.tmLanguage index 88cda044..f8f2eedb 100644 --- a/TypeScript.tmLanguage +++ b/TypeScript.tmLanguage @@ -1604,7 +1604,7 @@ begin : end - (?=$|[,);\}\]]|//)|(?==[^>])|(?<=[\}>\]\)]|[a-zA-Z_$])\s*(?=\{) + (?=$|[,);\}\]]|//)|(?==[^>])|(?<=[\}>\]\)]|[\w$])\s*(?=\{) name meta.type.annotation.ts patterns diff --git a/tests/baselines/Issue188.txt b/tests/baselines/Issue188.txt new file mode 100644 index 00000000..7d14480f --- /dev/null +++ b/tests/baselines/Issue188.txt @@ -0,0 +1,8 @@ +[9, 22]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.type.annotation.ts meta.type.name.ts +[9, 29]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts meta.brace.curly.ts +[12, 5]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts keyword.control.ts +[12, 12]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts constant.language.this.ts +[24, 22]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.type.annotation.ts meta.type.name.ts +[24, 30]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts meta.brace.curly.ts +[27, 5]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts keyword.control.ts +[27, 12]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts constant.language.this.ts diff --git a/tests/cases/Issue188.ts b/tests/cases/Issue188.ts new file mode 100644 index 00000000..270bea3e --- /dev/null +++ b/tests/cases/Issue188.ts @@ -0,0 +1,29 @@ +class Matrix { + + public elements; + + constructor() { + this.elements = new Float32Array([1]); + } + + set(m11: number) : ^^Matrix ^^{ + this.elements[0] = m11; + + ^^return ^^this; + } +} + +class Matrix1 { + + public elements; + + constructor() { + this.elements = new Float32Array([1]); + } + + set(m11: number) : ^^Matrix1 ^^{ + this.elements[0] = m11; + + ^^return ^^this; + } +}