Skip to content

Commit 2e0fded

Browse files
committed
Handle incorrect order of string and comment matching
Fixes #793
1 parent dc5fe35 commit 2e0fded

File tree

5 files changed

+37
-18
lines changed

5 files changed

+37
-18
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@ patterns:
141141
repository:
142142
statements:
143143
patterns:
144-
- include: '#string'
145-
- include: '#comment'
146144
- include: '#declaration'
147145
- include: '#control-statement'
148146
- include: '#after-operator-block-as-object-literal'
149147
- include: '#decl-block'
150148
- include: '#label'
151149
- include: '#expression'
152150
- include: '#punctuation-semicolon'
151+
- include: '#string'
152+
- include: '#comment'
153153

154154
declaration:
155155
patterns:

TypeScript.tmLanguage

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@
4343
<dict>
4444
<key>patterns</key>
4545
<array>
46-
<dict>
47-
<key>include</key>
48-
<string>#string</string>
49-
</dict>
50-
<dict>
51-
<key>include</key>
52-
<string>#comment</string>
53-
</dict>
5446
<dict>
5547
<key>include</key>
5648
<string>#declaration</string>
@@ -79,6 +71,14 @@
7971
<key>include</key>
8072
<string>#punctuation-semicolon</string>
8173
</dict>
74+
<dict>
75+
<key>include</key>
76+
<string>#string</string>
77+
</dict>
78+
<dict>
79+
<key>include</key>
80+
<string>#comment</string>
81+
</dict>
8282
</array>
8383
</dict>
8484
<key>declaration</key>

TypeScriptReact.tmLanguage

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@
4343
<dict>
4444
<key>patterns</key>
4545
<array>
46-
<dict>
47-
<key>include</key>
48-
<string>#string</string>
49-
</dict>
50-
<dict>
51-
<key>include</key>
52-
<string>#comment</string>
53-
</dict>
5446
<dict>
5547
<key>include</key>
5648
<string>#declaration</string>
@@ -79,6 +71,14 @@
7971
<key>include</key>
8072
<string>#punctuation-semicolon</string>
8173
</dict>
74+
<dict>
75+
<key>include</key>
76+
<string>#string</string>
77+
</dict>
78+
<dict>
79+
<key>include</key>
80+
<string>#comment</string>
81+
</dict>
8282
</array>
8383
</dict>
8484
<key>declaration</key>

tests/baselines/Issue793.baseline.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
original file
2+
-----------------------------------
3+
return`tagged string`;
4+
-----------------------------------
5+
6+
Grammar: TypeScript.tmLanguage
7+
-----------------------------------
8+
>return`tagged string`;
9+
^^^^^^
10+
source.ts keyword.control.flow.ts
11+
^
12+
source.ts string.template.ts punctuation.definition.string.template.begin.ts
13+
^^^^^^^^^^^^^
14+
source.ts string.template.ts
15+
^
16+
source.ts string.template.ts punctuation.definition.string.template.end.ts
17+
^
18+
source.ts punctuation.terminator.statement.ts

tests/cases/Issue793.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
return`tagged string`;

0 commit comments

Comments
 (0)