Skip to content

Commit

Permalink
End type parameter regex only on '>'
Browse files Browse the repository at this point in the history
Fixes #452
  • Loading branch information
sheetalkamat committed May 18, 2017
1 parent ac0314e commit 632a9db
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 3 deletions.
2 changes: 1 addition & 1 deletion TypeScript.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ repository:
begin: '(<)'
beginCaptures:
'1': { name: punctuation.definition.typeparameters.begin.ts }
end: '(?=$)|(>)'
end: '(>)'
endCaptures:
'1': { name: punctuation.definition.typeparameters.end.ts }
patterns:
Expand Down
2 changes: 1 addition & 1 deletion TypeScript.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -3125,7 +3125,7 @@
</dict>
</dict>
<key>end</key>
<string>(?=$)|(&gt;)</string>
<string>(&gt;)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
Expand Down
2 changes: 1 addition & 1 deletion TypeScriptReact.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -3129,7 +3129,7 @@
</dict>
</dict>
<key>end</key>
<string>(?=$)|(&gt;)</string>
<string>(&gt;)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
Expand Down
100 changes: 100 additions & 0 deletions tests/baselines/Issue452.baseline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
original file
-----------------------------------
class Test<A, B>{}
class Favorite extends Test<
string | number,
undefined
> {
// class content
}
-----------------------------------

Grammar: TypeScript.tmLanguage
-----------------------------------
>class Test<A, B>{}
^^^^^
source.ts meta.class.ts storage.type.class.ts
^
source.ts meta.class.ts
^^^^
source.ts meta.class.ts entity.name.type.class.ts
^
source.ts meta.class.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
^
source.ts meta.class.ts meta.type.parameters.ts entity.name.type.ts
^
source.ts meta.class.ts meta.type.parameters.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts meta.type.parameters.ts
^
source.ts meta.class.ts meta.type.parameters.ts entity.name.type.ts
^
source.ts meta.class.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
^
source.ts meta.class.ts punctuation.definition.block.ts
^
source.ts meta.class.ts punctuation.definition.block.ts
^^
source.ts
>class Favorite extends Test<
^^^^^
source.ts meta.class.ts storage.type.class.ts
^
source.ts meta.class.ts
^^^^^^^^
source.ts meta.class.ts entity.name.type.class.ts
^
source.ts meta.class.ts
^^^^^^^
source.ts meta.class.ts storage.modifier.ts
^
source.ts meta.class.ts
^^^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
^^
source.ts meta.class.ts meta.type.parameters.ts
> string | number,
^^
source.ts meta.class.ts meta.type.parameters.ts
^^^^^^
source.ts meta.class.ts meta.type.parameters.ts support.type.primitive.ts
^
source.ts meta.class.ts meta.type.parameters.ts
^
source.ts meta.class.ts meta.type.parameters.ts keyword.operator.type.ts
^
source.ts meta.class.ts meta.type.parameters.ts
^^^^^^
source.ts meta.class.ts meta.type.parameters.ts support.type.primitive.ts
^
source.ts meta.class.ts meta.type.parameters.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts meta.type.parameters.ts
> undefined
^^
source.ts meta.class.ts meta.type.parameters.ts
^^^^^^^^^
source.ts meta.class.ts meta.type.parameters.ts support.type.builtin.ts
^^
source.ts meta.class.ts meta.type.parameters.ts
>> {
^
source.ts meta.class.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.definition.block.ts
^^
source.ts meta.class.ts
> // class content
^^
source.ts meta.class.ts punctuation.whitespace.comment.leading.ts
^^
source.ts meta.class.ts comment.line.double-slash.ts punctuation.definition.comment.ts
^^^^^^^^^^^^^^^^^
source.ts meta.class.ts comment.line.double-slash.ts
>}
^
source.ts meta.class.ts punctuation.definition.block.ts
7 changes: 7 additions & 0 deletions tests/cases/Issue452.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Test<A, B>{}
class Favorite extends Test<
string | number,
undefined
> {
// class content
}

0 comments on commit 632a9db

Please sign in to comment.