Skip to content

Commit

Permalink
Allow method return types to end with a digit
Browse files Browse the repository at this point in the history
  • Loading branch information
gcnew committed Jun 30, 2016
1 parent a78f05a commit 7d36891
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion TypeScript.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ repository:
type-annotation:
name: meta.type.annotation.ts
begin: ":"
end: (?=$|[,);\}\]]|//)|(?==[^>])|(?<=[\}>\]\)]|[a-zA-Z_$])\s*(?=\{)
end: (?=$|[,);\}\]]|//)|(?==[^>])|(?<=[\}>\]\)]|[a-zA-Z0-9_$])\s*(?=\{)
patterns:
- include: '#expression-operator'
- include: '#type'
Expand Down
2 changes: 1 addition & 1 deletion TypeScript.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,7 @@
<key>begin</key>
<string>:</string>
<key>end</key>
<string>(?=$|[,);\}\]]|//)|(?==[^&gt;])|(?&lt;=[\}&gt;\]\)]|[a-zA-Z_$])\s*(?=\{)</string>
<string>(?=$|[,);\}\]]|//)|(?==[^&gt;])|(?&lt;=[\}&gt;\]\)]|[a-zA-Z0-9_$])\s*(?=\{)</string>
<key>name</key>
<string>meta.type.annotation.ts</string>
<key>patterns</key>
Expand Down
2 changes: 1 addition & 1 deletion TypeScriptReact.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ repository:
type-annotation:
name: meta.type.annotation.tsx
begin: ":"
end: (?=$|[,);\}\]]|//)|(?==[^>])|(?<=[\}>\]\)]|[a-zA-Z_$])\s*(?=\{)
end: (?=$|[,);\}\]]|//)|(?==[^>])|(?<=[\}>\]\)]|[a-zA-Z0-9_$])\s*(?=\{)
patterns:
- include: '#expression-operator'
- include: '#type'
Expand Down
2 changes: 1 addition & 1 deletion TypeScriptReact.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -1970,7 +1970,7 @@
<key>begin</key>
<string>:</string>
<key>end</key>
<string>(?=$|[,);\}\]]|//)|(?==[^&gt;])|(?&lt;=[\}&gt;\]\)]|[a-zA-Z_$])\s*(?=\{)</string>
<string>(?=$|[,);\}\]]|//)|(?==[^&gt;])|(?&lt;=[\}&gt;\]\)]|[a-zA-Z0-9_$])\s*(?=\{)</string>
<key>name</key>
<string>meta.type.annotation.tsx</string>
<key>patterns</key>
Expand Down
5 changes: 4 additions & 1 deletion tests/baselines/FunctionMethodReturnTypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,7 @@
[29, 59]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts keyword.control.ts
[30, 5]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts storage.modifier.ts
[30, 12]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts entity.name.function.ts
[30, 69]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts keyword.control.ts
[30, 69]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts keyword.control.ts
[31, 5]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts storage.modifier.ts
[31, 12]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts entity.name.function.ts
[31, 55]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts keyword.control.ts
5 changes: 4 additions & 1 deletion tests/cases/FunctionMethodReturnTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ class TestClass {
^^public ^^testMethodReturnType11(): number | string { ^^return 1 }
^^public ^^testMethodReturnType12(): number | string [] { ^^return }
^^public ^^testMethodReturnType13(): [number, number] | string [] { ^^return [""] }
}
^^public ^^testMethodReturnType14(): EndsWithDigit1 { ^^return 123 }
}

type EndsWithDigit1 = number;

0 comments on commit 7d36891

Please sign in to comment.