Skip to content

Commit dd81cfb

Browse files
committed
Fix scope extensions for .tsx shebang
Fixes #813
1 parent cfe0dcf commit dd81cfb

File tree

4 files changed

+26
-22
lines changed

4 files changed

+26
-22
lines changed

TypeScript.YAML-tmLanguage

+7-4
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,15 @@ variables:
140140
patterns:
141141
- include: '#directives'
142142
- include: '#statements'
143-
- name: comment.line.shebang.ts
144-
match: \A(#!).*(?=$)
145-
captures:
146-
'1': { name: punctuation.definition.comment.ts }
143+
- include: '#shebang'
147144

148145
repository:
146+
shebang:
147+
name: comment.line.shebang.ts
148+
match: \A(#!).*(?=$)
149+
captures:
150+
'1': { name: punctuation.definition.comment.ts }
151+
149152
statements:
150153
patterns:
151154
- include: '#declaration'

TypeScript.tmLanguage

+8-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@
2222
<key>include</key>
2323
<string>#statements</string>
2424
</dict>
25+
<dict>
26+
<key>include</key>
27+
<string>#shebang</string>
28+
</dict>
29+
</array>
30+
<key>repository</key>
31+
<dict>
32+
<key>shebang</key>
2533
<dict>
2634
<key>name</key>
2735
<string>comment.line.shebang.ts</string>
@@ -36,9 +44,6 @@
3644
</dict>
3745
</dict>
3846
</dict>
39-
</array>
40-
<key>repository</key>
41-
<dict>
4247
<key>statements</key>
4348
<dict>
4449
<key>patterns</key>

TypeScriptReact.tmLanguage

+10-5
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,28 @@
2222
<key>include</key>
2323
<string>#statements</string>
2424
</dict>
25+
<dict>
26+
<key>include</key>
27+
<string>#shebang</string>
28+
</dict>
29+
</array>
30+
<key>repository</key>
31+
<dict>
32+
<key>shebang</key>
2533
<dict>
2634
<key>name</key>
27-
<string>comment.line.shebang.ts</string>
35+
<string>comment.line.shebang.tsx</string>
2836
<key>match</key>
2937
<string>\A(#!).*(?=$)</string>
3038
<key>captures</key>
3139
<dict>
3240
<key>1</key>
3341
<dict>
3442
<key>name</key>
35-
<string>punctuation.definition.comment.ts</string>
43+
<string>punctuation.definition.comment.tsx</string>
3644
</dict>
3745
</dict>
3846
</dict>
39-
</array>
40-
<key>repository</key>
41-
<dict>
4247
<key>statements</key>
4348
<dict>
4449
<key>patterns</key>

tests/baselines/Issue337.baseline.txt

+1-10
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,4 @@ Grammar: TypeScript.tmLanguage
99
^^
1010
source.ts comment.line.shebang.ts punctuation.definition.comment.ts
1111
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12-
source.ts comment.line.shebang.ts
13-
14-
15-
Grammar: TypeScriptReact.tmLanguage
16-
-----------------------------------
17-
>#!/usr/bin/env node -r babel-register
18-
^^
19-
source.tsx comment.line.shebang.ts punctuation.definition.comment.ts INCORRECT_SCOPE_EXTENSION
20-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21-
source.tsx comment.line.shebang.ts INCORRECT_SCOPE_EXTENSION
12+
source.ts comment.line.shebang.ts

0 commit comments

Comments
 (0)