Skip to content

Commit c837acc

Browse files
committed
Rename switch related scopes
1 parent ee0974e commit c837acc

File tree

7 files changed

+100
-100
lines changed

7 files changed

+100
-100
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ repository:
393393
- include: '#declaration'
394394
- include: '#cast'
395395
- include: '#new-expr'
396-
- include: '#switch-expression'
396+
- include: '#switch-statement'
397397
- include: '#block'
398398
- include: '#expression-operator'
399399
- include: '#relational-operator'
@@ -402,11 +402,11 @@ repository:
402402
- include: '#assignment-operator'
403403
- include: '#storage-keyword'
404404
- include: '#function-call'
405-
- include: '#switch-case'
405+
- include: '#case-clause'
406406
- include: '#control-statement'
407407

408-
switch-variable:
409-
name: switch-variable.expr.ts
408+
switch-expression:
409+
name: switch-expression.expr.ts
410410
begin: \b(switch)\b\s*\(
411411
beginCaptures:
412412
'1': { name: keyword.operator.ts }
@@ -421,21 +421,21 @@ repository:
421421
patterns:
422422
- include: '#expression'
423423

424-
switch-case:
425-
name: case.expr.ts
424+
case-clause:
425+
name: case-clause.expr.ts
426426
begin: '(?<!\.)\b(case|default)\b'
427427
beginCaptures:
428428
'1': { name: keyword.control.ts }
429429
end: ':'
430430
patterns:
431431
- include: '#expression'
432432

433-
switch-expression:
434-
name: switch-expr.expr.ts
433+
switch-statement:
434+
name: switch-statement.expr.ts
435435
begin: (?=\bswitch\b\s*\()
436436
end: '}'
437437
patterns:
438-
- include: '#switch-variable'
438+
- include: '#switch-expression'
439439
- include: '#switch-block'
440440

441441
for-in-simple:

TypeScript.tmLanguage

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,30 @@
120120
<key>name</key>
121121
<string>constant.language.boolean.ts</string>
122122
</dict>
123+
<key>case-clause</key>
124+
<dict>
125+
<key>begin</key>
126+
<string>(?&lt;!\.)\b(case|default)\b</string>
127+
<key>beginCaptures</key>
128+
<dict>
129+
<key>1</key>
130+
<dict>
131+
<key>name</key>
132+
<string>keyword.control.ts</string>
133+
</dict>
134+
</dict>
135+
<key>end</key>
136+
<string>:</string>
137+
<key>name</key>
138+
<string>case-clause.expr.ts</string>
139+
<key>patterns</key>
140+
<array>
141+
<dict>
142+
<key>include</key>
143+
<string>#expression</string>
144+
</dict>
145+
</array>
146+
</dict>
123147
<key>cast</key>
124148
<dict>
125149
<key>begin</key>
@@ -337,7 +361,7 @@
337361
</dict>
338362
<dict>
339363
<key>include</key>
340-
<string>#switch-expression</string>
364+
<string>#switch-statement</string>
341365
</dict>
342366
<dict>
343367
<key>include</key>
@@ -373,7 +397,7 @@
373397
</dict>
374398
<dict>
375399
<key>include</key>
376-
<string>#switch-case</string>
400+
<string>#case-clause</string>
377401
</dict>
378402
<dict>
379403
<key>include</key>
@@ -1260,22 +1284,22 @@
12601284
</dict>
12611285
</array>
12621286
</dict>
1263-
<key>switch-case</key>
1287+
<key>switch-expression</key>
12641288
<dict>
12651289
<key>begin</key>
1266-
<string>(?&lt;!\.)\b(case|default)\b</string>
1290+
<string>\b(switch)\b\s*\(</string>
12671291
<key>beginCaptures</key>
12681292
<dict>
12691293
<key>1</key>
12701294
<dict>
12711295
<key>name</key>
1272-
<string>keyword.control.ts</string>
1296+
<string>keyword.operator.ts</string>
12731297
</dict>
12741298
</dict>
12751299
<key>end</key>
1276-
<string>:</string>
1300+
<string>\)</string>
12771301
<key>name</key>
1278-
<string>case.expr.ts</string>
1302+
<string>switch-expression.expr.ts</string>
12791303
<key>patterns</key>
12801304
<array>
12811305
<dict>
@@ -1284,50 +1308,26 @@
12841308
</dict>
12851309
</array>
12861310
</dict>
1287-
<key>switch-expression</key>
1311+
<key>switch-statement</key>
12881312
<dict>
12891313
<key>begin</key>
12901314
<string>(?=\bswitch\b\s*\()</string>
12911315
<key>end</key>
12921316
<string>}</string>
12931317
<key>name</key>
1294-
<string>switch-expr.expr.ts</string>
1318+
<string>switch-statement.expr.ts</string>
12951319
<key>patterns</key>
12961320
<array>
12971321
<dict>
12981322
<key>include</key>
1299-
<string>#switch-variable</string>
1323+
<string>#switch-expression</string>
13001324
</dict>
13011325
<dict>
13021326
<key>include</key>
13031327
<string>#switch-block</string>
13041328
</dict>
13051329
</array>
13061330
</dict>
1307-
<key>switch-variable</key>
1308-
<dict>
1309-
<key>begin</key>
1310-
<string>\b(switch)\b\s*\(</string>
1311-
<key>beginCaptures</key>
1312-
<dict>
1313-
<key>1</key>
1314-
<dict>
1315-
<key>name</key>
1316-
<string>keyword.operator.ts</string>
1317-
</dict>
1318-
</dict>
1319-
<key>end</key>
1320-
<string>\)</string>
1321-
<key>name</key>
1322-
<string>switch-variable.expr.ts</string>
1323-
<key>patterns</key>
1324-
<array>
1325-
<dict>
1326-
<key>include</key>
1327-
<string>#expression</string>
1328-
</dict>
1329-
</array>
1330-
</dict>
13311331
<key>template</key>
13321332
<dict>
13331333
<key>begin</key>

TypeScriptReact.YAML-tmLanguage

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ repository:
387387
- include: '#var-expr'
388388
- include: '#declaration'
389389
- include: '#new-expr'
390-
- include: '#switch-expression'
390+
- include: '#switch-statement'
391391
- include: '#block'
392392
- include: '#expression-operator'
393393
- include: '#relational-operator'
@@ -396,11 +396,11 @@ repository:
396396
- include: '#assignment-operator'
397397
- include: '#storage-keyword'
398398
- include: '#function-call'
399-
- include: '#switch-case'
399+
- include: '#case-clause'
400400
- include: '#control-statement'
401401

402-
switch-variable:
403-
name: switch-variable.expr.tsx
402+
switch-expression:
403+
name: switch-expression.expr.tsx
404404
begin: \b(switch)\b\s*\(
405405
beginCaptures:
406406
'1': { name: keyword.operator.tsx }
@@ -415,21 +415,21 @@ repository:
415415
patterns:
416416
- include: '#expression'
417417

418-
switch-case:
419-
name: case.expr.tsx
418+
case-clause:
419+
name: case-clause.expr.tsx
420420
begin: '(?<!\.)\b(case|default)\b'
421421
beginCaptures:
422422
'1': { name: keyword.control.tsx }
423423
end: ':'
424424
patterns:
425425
- include: '#expression'
426426

427-
switch-expression:
428-
name: switch-expr.expr.tsx
427+
switch-statement:
428+
name: switch-statement.expr.tsx
429429
begin: (?=\bswitch\b\s*\()
430430
end: '}'
431431
patterns:
432-
- include: '#switch-variable'
432+
- include: '#switch-expression'
433433
- include: '#switch-block'
434434

435435

TypeScriptReact.tmLanguage

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,30 @@
113113
<key>name</key>
114114
<string>constant.language.boolean.tsx</string>
115115
</dict>
116+
<key>case-clause</key>
117+
<dict>
118+
<key>begin</key>
119+
<string>(?&lt;!\.)\b(case|default)\b</string>
120+
<key>beginCaptures</key>
121+
<dict>
122+
<key>1</key>
123+
<dict>
124+
<key>name</key>
125+
<string>keyword.control.tsx</string>
126+
</dict>
127+
</dict>
128+
<key>end</key>
129+
<string>:</string>
130+
<key>name</key>
131+
<string>case-clause.expr.tsx</string>
132+
<key>patterns</key>
133+
<array>
134+
<dict>
135+
<key>include</key>
136+
<string>#expression</string>
137+
</dict>
138+
</array>
139+
</dict>
116140
<key>comment</key>
117141
<dict>
118142
<key>name</key>
@@ -298,7 +322,7 @@
298322
</dict>
299323
<dict>
300324
<key>include</key>
301-
<string>#switch-expression</string>
325+
<string>#switch-statement</string>
302326
</dict>
303327
<dict>
304328
<key>include</key>
@@ -334,7 +358,7 @@
334358
</dict>
335359
<dict>
336360
<key>include</key>
337-
<string>#switch-case</string>
361+
<string>#case-clause</string>
338362
</dict>
339363
<dict>
340364
<key>include</key>
@@ -1586,22 +1610,22 @@
15861610
</dict>
15871611
</array>
15881612
</dict>
1589-
<key>switch-case</key>
1613+
<key>switch-expression</key>
15901614
<dict>
15911615
<key>begin</key>
1592-
<string>(?&lt;!\.)\b(case|default)\b</string>
1616+
<string>\b(switch)\b\s*\(</string>
15931617
<key>beginCaptures</key>
15941618
<dict>
15951619
<key>1</key>
15961620
<dict>
15971621
<key>name</key>
1598-
<string>keyword.control.tsx</string>
1622+
<string>keyword.operator.tsx</string>
15991623
</dict>
16001624
</dict>
16011625
<key>end</key>
1602-
<string>:</string>
1626+
<string>\)</string>
16031627
<key>name</key>
1604-
<string>case.expr.tsx</string>
1628+
<string>switch-expression.expr.tsx</string>
16051629
<key>patterns</key>
16061630
<array>
16071631
<dict>
@@ -1610,50 +1634,26 @@
16101634
</dict>
16111635
</array>
16121636
</dict>
1613-
<key>switch-expression</key>
1637+
<key>switch-statement</key>
16141638
<dict>
16151639
<key>begin</key>
16161640
<string>(?=\bswitch\b\s*\()</string>
16171641
<key>end</key>
16181642
<string>}</string>
16191643
<key>name</key>
1620-
<string>switch-expr.expr.tsx</string>
1644+
<string>switch-statement.expr.tsx</string>
16211645
<key>patterns</key>
16221646
<array>
16231647
<dict>
16241648
<key>include</key>
1625-
<string>#switch-variable</string>
1649+
<string>#switch-expression</string>
16261650
</dict>
16271651
<dict>
16281652
<key>include</key>
16291653
<string>#switch-block</string>
16301654
</dict>
16311655
</array>
16321656
</dict>
1633-
<key>switch-variable</key>
1634-
<dict>
1635-
<key>begin</key>
1636-
<string>\b(switch)\b\s*\(</string>
1637-
<key>beginCaptures</key>
1638-
<dict>
1639-
<key>1</key>
1640-
<dict>
1641-
<key>name</key>
1642-
<string>keyword.operator.tsx</string>
1643-
</dict>
1644-
</dict>
1645-
<key>end</key>
1646-
<string>\)</string>
1647-
<key>name</key>
1648-
<string>switch-variable.expr.tsx</string>
1649-
<key>patterns</key>
1650-
<array>
1651-
<dict>
1652-
<key>include</key>
1653-
<string>#expression</string>
1654-
</dict>
1655-
</array>
1656-
</dict>
16571657
<key>template</key>
16581658
<dict>
16591659
<key>begin</key>

tests/baselines/Issue156.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[2, 2]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts entity.name.function.ts
2-
[2, 7]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts parameter.name.ts variable.parameter.ts
3-
[2, 13]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts meta.type.annotation.ts meta.type.primitive.ts storage.type.ts
4-
[2, 22]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts meta.type.annotation.ts meta.object.type.ts meta.brace.curly.ts
5-
[2, 26]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts parameter.name.ts variable.parameter.ts
6-
[2, 38]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts meta.type.annotation.ts meta.type.primitive.ts storage.type.ts
2+
[2, 6]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts parameter.name.ts variable.parameter.ts
3+
[2, 10]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts meta.type.annotation.ts meta.type.primitive.ts storage.type.ts
4+
[2, 19]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts meta.type.annotation.ts meta.object.type.ts meta.brace.curly.ts
5+
[2, 23]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts parameter.name.ts variable.parameter.ts
6+
[2, 27]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.function.type.parameter.ts meta.type.annotation.ts meta.type.primitive.ts storage.type.ts
77
[4, 9]: source.ts meta.declaration.object.ts meta.object.body.ts meta.method.declaration.ts meta.decl.block.ts

0 commit comments

Comments
 (0)