Skip to content

Commit 0cfd3b8

Browse files
committed
Apply PR #48 to TypeScriptReact grammar too
1 parent 1a663e2 commit 0cfd3b8

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

TypeScriptReact.YAML-tmLanguage

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ patterns:
1414
repository:
1515
var-expr:
1616
name: meta.var.expr.tsx
17-
begin: (?<!\()\s*\b(var|let|const(?!\s+enum))\s+([a-zA-Z_$][\w$]*)
17+
begin: (?<!\()\s*\b(var|let|const(?!\s+enum))\s+([a-zA-Z_$][\w$]*)
1818
beginCaptures:
1919
'1': { name: storage.type.tsx }
2020
'2': { name: variable.tsx }
@@ -28,7 +28,7 @@ repository:
2828
name: keyword.control.tsx
2929
match: (?<!\.)\b(break|catch|continue|debugger|declare|do|else|finally|for|if|return|switch|throw|try|while|with|super|switch|case)\b
3030

31-
switch-case:
31+
switch-case:
3232
name: case.expr.tsx
3333
begin: '(?<!\.)\b(case|default)\b'
3434
beginCaptures:
@@ -51,7 +51,7 @@ repository:
5151
beginCaptures:
5252
'1': { name: keyword.other.tsx }
5353
'2': { name: storage.type.tsx }
54-
end: (?=[,);>]|var|type|function|class|interface)
54+
end: (?=$|[,);>]|var|type|function|class|interface)
5555
patterns:
5656
- include: '#type'
5757

@@ -146,7 +146,7 @@ repository:
146146
beginCaptures:
147147
'1': { name: variable.tsx }
148148
'2': { name: keyword.operator.tsx }
149-
end: '(?=\}|;|,)|(?<=\})'
149+
end: '(?=\}|;|,|$)|(?<=\})'
150150
patterns:
151151
- include: '#expression'
152152

@@ -160,7 +160,7 @@ repository:
160160
'4': { name: keyword.operator.tsx }
161161
'5': { name: entity.name.function.tsx }
162162
'6': { name: keyword.operator.tsx }
163-
end: '(?=\}|;|,)|(?<=\})'
163+
end: '(?=\}|;|,|$)|(?<=\})'
164164
patterns:
165165
- include: '#comment'
166166
- include: '#type-parameters'
@@ -197,7 +197,7 @@ repository:
197197
match: ([a-zA-Z_$][\w$]*)(?=\:)
198198
captures:
199199
'1': { name: variable.parameter.tsx}
200-
200+
201201
function-declaration:
202202
name: meta.function.tsx
203203
begin: \b(?:(export)\s+)?(function\b)(?:\s+([a-zA-Z_$][\w$]*))?\s*
@@ -316,7 +316,7 @@ repository:
316316
- include: '#comment'
317317
- include: '#type'
318318
- include: '#function-type-parameters'
319-
319+
320320
type-operator:
321321
name: keyword.operator.type.tsx
322322
match: '[.|]'
@@ -354,7 +354,7 @@ repository:
354354
beginCaptures:
355355
'1': { name: entity.name.type.tsx }
356356
'2': { name: meta.brace.angle.tsx }
357-
end: '(?=$)|(>)'
357+
end: '(?=$)|(>)'
358358
endCaptures:
359359
'2': { name: meta.brace.angle.tsx }
360360
patterns:
@@ -369,7 +369,7 @@ repository:
369369
'1': { name: keyword.operator.tsx }
370370
end: (?=$|[,);=])
371371
patterns:
372-
- include: '#expression'
372+
- include: '#expression'
373373

374374
expression:
375375
name: meta.expression.tsx
@@ -395,7 +395,7 @@ repository:
395395
- include: '#function-call'
396396
- include: '#switch-case'
397397
- include: '#control-statement'
398-
398+
399399
for-in-simple:
400400
name: forin.expr.tsx
401401
match: (?<=\()\s*\b(var|let|const)\s+([a-zA-Z_$][\w$]*)\s+(in|of)\b
@@ -567,7 +567,7 @@ repository:
567567
- include: '#expression'
568568

569569
numeric-literal:
570-
name: constant.numeric.tsx
570+
name: constant.numeric.tsx
571571
match: \b(?<=[^$])((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b
572572

573573
boolean-literal:
@@ -577,19 +577,19 @@ repository:
577577
null-literal:
578578
name: constant.language.null.tsx
579579
match: \b(null)\b
580-
580+
581581
this-literal:
582582
name: constant.language.this.tsx
583583
match: \b(this)\b
584-
584+
585585
undefined-literal:
586586
name: constant.language.tsx
587587
match: \b(undefined)\b
588588

589589
access-modifier:
590590
name: storage.modifier.tsx
591591
match: \b(public|protected|private)\b
592-
592+
593593
static-modifier:
594594
name: keyword.other.tsx
595595
match: \b(static)\b

TypeScriptReact.tmLanguage

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@
363363
</dict>
364364
</dict>
365365
<key>end</key>
366-
<string>(?=\}|;|,)|(?&lt;=\})</string>
366+
<string>(?=\}|;|,|$)|(?&lt;=\})</string>
367367
<key>name</key>
368368
<string>meta.field.declaration.tsx</string>
369369
<key>patterns</key>
@@ -1068,7 +1068,7 @@
10681068
</dict>
10691069
</dict>
10701070
<key>end</key>
1071-
<string>(?=\}|;|,)|(?&lt;=\})</string>
1071+
<string>(?=\}|;|,|$)|(?&lt;=\})</string>
10721072
<key>name</key>
10731073
<string>meta.method.declaration.tsx</string>
10741074
<key>patterns</key>
@@ -1759,7 +1759,7 @@
17591759
</dict>
17601760
</dict>
17611761
<key>end</key>
1762-
<string>(?=[,);&gt;]|var|type|function|class|interface)</string>
1762+
<string>(?=$|[,);&gt;]|var|type|function|class|interface)</string>
17631763
<key>name</key>
17641764
<string>meta.type.declaration.tsx</string>
17651765
<key>patterns</key>

0 commit comments

Comments
 (0)