File tree Expand file tree Collapse file tree 6 files changed +56
-57
lines changed Expand file tree Collapse file tree 6 files changed +56
-57
lines changed Original file line number Diff line number Diff line change @@ -1996,16 +1996,12 @@ repository:
1996
1996
end : \*/
1997
1997
endCaptures :
1998
1998
' 0 ' : { name: punctuation.definition.comment.ts }
1999
- - begin : (^[ \t]+)?(?= //)
1999
+ - begin : (^[ \t]+)?(//)
2000
2000
beginCaptures :
2001
2001
' 1 ' : { name: punctuation.whitespace.comment.leading.ts }
2002
- end : (?=^[^/][^/])
2003
- patterns :
2004
- - name : comment.line.double-slash.ts
2005
- begin : //
2006
- beginCaptures :
2007
- ' 0 ' : { name: punctuation.definition.comment.ts }
2008
- end : (?=^)
2002
+ ' 2 ' : { name: comment.line.double-slash.ts punctuation.definition.comment.ts }
2003
+ end : (?=^)
2004
+ contentName : comment.line.double-slash.ts
2009
2005
2010
2006
directives :
2011
2007
name : comment.line.triple-slash.directive.ts
Original file line number Diff line number Diff line change 5495
5495
</dict >
5496
5496
<dict >
5497
5497
<key >begin </key >
5498
- <string >(^[ \t]+)?(?= //) </string >
5498
+ <string >(^[ \t]+)?(//) </string >
5499
5499
<key >beginCaptures </key >
5500
5500
<dict >
5501
5501
<key >1 </key >
5502
5502
<dict >
5503
5503
<key >name </key >
5504
5504
<string >punctuation.whitespace.comment.leading.ts </string >
5505
5505
</dict >
5506
- </dict >
5507
- <key >end </key >
5508
- <string >(?=^[^/][^/]) </string >
5509
- <key >patterns </key >
5510
- <array >
5506
+ <key >2 </key >
5511
5507
<dict >
5512
5508
<key >name </key >
5513
- <string >comment.line.double-slash.ts </string >
5514
- <key >begin </key >
5515
- <string >// </string >
5516
- <key >beginCaptures </key >
5517
- <dict >
5518
- <key >0 </key >
5519
- <dict >
5520
- <key >name </key >
5521
- <string >punctuation.definition.comment.ts </string >
5522
- </dict >
5523
- </dict >
5524
- <key >end </key >
5525
- <string >(?=^) </string >
5509
+ <string >comment.line.double-slash.ts punctuation.definition.comment.ts </string >
5526
5510
</dict >
5527
- </array >
5511
+ </dict >
5512
+ <key >end </key >
5513
+ <string >(?=^) </string >
5514
+ <key >contentName </key >
5515
+ <string >comment.line.double-slash.ts </string >
5528
5516
</dict >
5529
5517
</array >
5530
5518
</dict >
Original file line number Diff line number Diff line change 5441
5441
</dict >
5442
5442
<dict >
5443
5443
<key >begin </key >
5444
- <string >(^[ \t]+)?(?= //) </string >
5444
+ <string >(^[ \t]+)?(//) </string >
5445
5445
<key >beginCaptures </key >
5446
5446
<dict >
5447
5447
<key >1 </key >
5448
5448
<dict >
5449
5449
<key >name </key >
5450
5450
<string >punctuation.whitespace.comment.leading.tsx </string >
5451
5451
</dict >
5452
- </dict >
5453
- <key >end </key >
5454
- <string >(?=^[^/][^/]) </string >
5455
- <key >patterns </key >
5456
- <array >
5452
+ <key >2 </key >
5457
5453
<dict >
5458
5454
<key >name </key >
5459
- <string >comment.line.double-slash.tsx </string >
5460
- <key >begin </key >
5461
- <string >// </string >
5462
- <key >beginCaptures </key >
5463
- <dict >
5464
- <key >0 </key >
5465
- <dict >
5466
- <key >name </key >
5467
- <string >punctuation.definition.comment.tsx </string >
5468
- </dict >
5469
- </dict >
5470
- <key >end </key >
5471
- <string >(?=^) </string >
5455
+ <string >comment.line.double-slash.tsx punctuation.definition.comment.tsx </string >
5472
5456
</dict >
5473
- </array >
5457
+ </dict >
5458
+ <key >end </key >
5459
+ <string >(?=^) </string >
5460
+ <key >contentName </key >
5461
+ <string >comment.line.double-slash.tsx </string >
5474
5462
</dict >
5475
5463
</array >
5476
5464
</dict >
Original file line number Diff line number Diff line change @@ -17,15 +17,20 @@ function changeTsToTsx(str: string) {
17
17
return str . replace ( / \. t s / g, '.tsx' ) ;
18
18
}
19
19
20
- function fixGrammarScopeNames ( rule : any ) {
21
- if ( typeof rule . name === 'string' ) {
22
- rule . name = changeTsToTsx ( rule . name ) ;
23
- }
24
- for ( var property in rule ) {
25
- var value = rule [ property ] ;
26
- if ( typeof value === 'object' ) {
27
- fixGrammarScopeNames ( value ) ;
28
- }
20
+ function fixRuleNames ( rule : any , name : string ) {
21
+ if ( typeof rule [ name ] === 'string' ) {
22
+ rule [ name ] = changeTsToTsx ( rule [ name ] ) ;
23
+ }
24
+ }
25
+
26
+ function fixGrammarScopeNames ( rule : any ) {
27
+ fixRuleNames ( rule , "name" ) ;
28
+ fixRuleNames ( rule , "contentName" ) ;
29
+ for ( var property in rule ) {
30
+ var value = rule [ property ] ;
31
+ if ( typeof value === 'object' ) {
32
+ fixGrammarScopeNames ( value ) ;
33
+ }
29
34
}
30
35
}
31
36
Original file line number Diff line number Diff line change
1
+ original file
2
+ -----------------------------------
3
+ // single-line comment
4
+ /* multi-line comment */
5
+ -----------------------------------
6
+
7
+ Grammar: TypeScript.tmLanguage
8
+ -----------------------------------
9
+ >// single-line comment
10
+ ^^
11
+ source.ts comment.line.double-slash.ts punctuation.definition.comment.ts
12
+ ^^^^^^^^^^^^^^^^^^^^^^
13
+ source.ts comment.line.double-slash.ts
14
+ >/* multi-line comment */
15
+ ^^
16
+ source.ts comment.block.ts punctuation.definition.comment.ts
17
+ ^^^^^^^^^^^^^^^^^^^^
18
+ source.ts comment.block.ts
19
+ ^^
20
+ source.ts comment.block.ts punctuation.definition.comment.ts
Original file line number Diff line number Diff line change
1
+ // single-line comment
2
+ /* multi-line comment */
You can’t perform that action at this time.
0 commit comments