Skip to content

Commit ce39790

Browse files
committed
add nullish coalescing support
1 parent 3890a41 commit ce39790

File tree

3 files changed

+6
-45
lines changed

3 files changed

+6
-45
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ repository:
218218
- include: '#arrow-function'
219219
- include: '#paren-expression-possibly-arrow'
220220
- include: '#cast'
221-
- include: '#nullish-coalesce'
222221
- include: '#ternary-expression'
223222
- include: '#new-expr'
224223
- include: '#instanceof-expr'
@@ -1415,15 +1414,9 @@ repository:
14151414
- include: '#expression'
14161415
- include: '#punctuation-comma'
14171416

1418-
#nullish coalesce
1419-
nullish-coalesce:
1420-
patterns:
1421-
- name: keyword.operator.logical.ts
1422-
match: \?\?
1423-
14241417
#ternary expression
14251418
ternary-expression:
1426-
begin: (?!\?\.\s*[^[:digit:]])(\?)
1419+
begin: (?!\?\.\s*[^[:digit:]])(\?)(?!\?)
14271420
beginCaptures:
14281421
'1': { name: keyword.operator.ternary.ts }
14291422
end: \s*(:)
@@ -1641,7 +1634,7 @@ repository:
16411634
- name: keyword.operator.relational.ts
16421635
match: <=|>=|<>|<|>
16431636
- name: keyword.operator.logical.ts
1644-
match: \!|&&|\|\|
1637+
match: \!|&&|\|\||\?\?
16451638
- name: keyword.operator.bitwise.ts
16461639
match: \&|~|\^|\|
16471640
- name: keyword.operator.assignment.ts

TypeScript.tmLanguage

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,6 @@
323323
<key>include</key>
324324
<string>#cast</string>
325325
</dict>
326-
<dict>
327-
<key>include</key>
328-
<string>#nullish-coalesce</string>
329-
</dict>
330326
<dict>
331327
<key>include</key>
332328
<string>#ternary-expression</string>
@@ -4591,22 +4587,10 @@
45914587
</dict>
45924588
</array>
45934589
</dict>
4594-
<key>nullish-coalesce</key>
4595-
<dict>
4596-
<key>patterns</key>
4597-
<array>
4598-
<dict>
4599-
<key>name</key>
4600-
<string>keyword.operator.logical.ts</string>
4601-
<key>match</key>
4602-
<string>\?\?</string>
4603-
</dict>
4604-
</array>
4605-
</dict>
46064590
<key>ternary-expression</key>
46074591
<dict>
46084592
<key>begin</key>
4609-
<string>(?!\?\.\s*[^[:digit:]])(\?)</string>
4593+
<string>(?!\?\.\s*[^[:digit:]])(\?)(?!\?)</string>
46104594
<key>beginCaptures</key>
46114595
<dict>
46124596
<key>1</key>
@@ -5343,7 +5327,7 @@
53435327
<key>name</key>
53445328
<string>keyword.operator.logical.ts</string>
53455329
<key>match</key>
5346-
<string>\!|&amp;&amp;|\|\|</string>
5330+
<string>\!|&amp;&amp;|\|\||\?\?</string>
53475331
</dict>
53485332
<dict>
53495333
<key>name</key>

TypeScriptReact.tmLanguage

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,6 @@
327327
<key>include</key>
328328
<string>#cast</string>
329329
</dict>
330-
<dict>
331-
<key>include</key>
332-
<string>#nullish-coalesce</string>
333-
</dict>
334330
<dict>
335331
<key>include</key>
336332
<string>#ternary-expression</string>
@@ -4615,22 +4611,10 @@
46154611
</dict>
46164612
</array>
46174613
</dict>
4618-
<key>nullish-coalesce</key>
4619-
<dict>
4620-
<key>patterns</key>
4621-
<array>
4622-
<dict>
4623-
<key>name</key>
4624-
<string>keyword.operator.logical.tsx</string>
4625-
<key>match</key>
4626-
<string>\?\?</string>
4627-
</dict>
4628-
</array>
4629-
</dict>
46304614
<key>ternary-expression</key>
46314615
<dict>
46324616
<key>begin</key>
4633-
<string>(?!\?\.\s*[^[:digit:]])(\?)</string>
4617+
<string>(?!\?\.\s*[^[:digit:]])(\?)(?!\?)</string>
46344618
<key>beginCaptures</key>
46354619
<dict>
46364620
<key>1</key>
@@ -5289,7 +5273,7 @@
52895273
<key>name</key>
52905274
<string>keyword.operator.logical.tsx</string>
52915275
<key>match</key>
5292-
<string>\!|&amp;&amp;|\|\|</string>
5276+
<string>\!|&amp;&amp;|\|\||\?\?</string>
52935277
</dict>
52945278
<dict>
52955279
<key>name</key>

0 commit comments

Comments
 (0)