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:
19961996 end : \*/
19971997 endCaptures :
19981998 ' 0 ' : { name: punctuation.definition.comment.ts }
1999- - begin : (^[ \t]+)?(?= //)
1999+ - begin : (^[ \t]+)?(//)
20002000 beginCaptures :
20012001 ' 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
20092005
20102006 directives :
20112007 name : comment.line.triple-slash.directive.ts
Original file line number Diff line number Diff line change 54955495 </dict >
54965496 <dict >
54975497 <key >begin </key >
5498- <string >(^[ \t]+)?(?= //) </string >
5498+ <string >(^[ \t]+)?(//) </string >
54995499 <key >beginCaptures </key >
55005500 <dict >
55015501 <key >1 </key >
55025502 <dict >
55035503 <key >name </key >
55045504 <string >punctuation.whitespace.comment.leading.ts </string >
55055505 </dict >
5506- </dict >
5507- <key >end </key >
5508- <string >(?=^[^/][^/]) </string >
5509- <key >patterns </key >
5510- <array >
5506+ <key >2 </key >
55115507 <dict >
55125508 <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 >
55265510 </dict >
5527- </array >
5511+ </dict >
5512+ <key >end </key >
5513+ <string >(?=^) </string >
5514+ <key >contentName </key >
5515+ <string >comment.line.double-slash.ts </string >
55285516 </dict >
55295517 </array >
55305518 </dict >
Original file line number Diff line number Diff line change 54415441 </dict >
54425442 <dict >
54435443 <key >begin </key >
5444- <string >(^[ \t]+)?(?= //) </string >
5444+ <string >(^[ \t]+)?(//) </string >
54455445 <key >beginCaptures </key >
54465446 <dict >
54475447 <key >1 </key >
54485448 <dict >
54495449 <key >name </key >
54505450 <string >punctuation.whitespace.comment.leading.tsx </string >
54515451 </dict >
5452- </dict >
5453- <key >end </key >
5454- <string >(?=^[^/][^/]) </string >
5455- <key >patterns </key >
5456- <array >
5452+ <key >2 </key >
54575453 <dict >
54585454 <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 >
54725456 </dict >
5473- </array >
5457+ </dict >
5458+ <key >end </key >
5459+ <string >(?=^) </string >
5460+ <key >contentName </key >
5461+ <string >comment.line.double-slash.tsx </string >
54745462 </dict >
54755463 </array >
54765464 </dict >
Original file line number Diff line number Diff line change @@ -17,15 +17,20 @@ function changeTsToTsx(str: string) {
1717 return str . replace ( / \. t s / g, '.tsx' ) ;
1818}
1919
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+ }
2934 }
3035}
3136
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