Fixes #933
This commit is contained in:
Sheetal Nandi 2022-09-21 11:47:46 -07:00
Родитель 44d73578fc
Коммит c2744520e3
5 изменённых файлов: 77 добавлений и 18 удалений

Просмотреть файл

@ -1385,13 +1385,13 @@ repository:
- include: '#array-literal'
- name: meta.object.member.ts meta.object-literal.key.ts
begin: (?=[\'\"\`])
end: (?=:)|((?<=[\'\"\`])(?=((\s*[\(\<,}])|(\s+(as)\s+))))
end: (?=:)|((?<=[\'\"\`])(?=((\s*[\(\<,}])|(\s+(as|satisifies)\s+))))
patterns:
- include: '#comment'
- include: '#string'
- name: meta.object.member.ts meta.object-literal.key.ts
begin: (?x)(?={{anyNumber}})
end: (?=:)|(?=\s*([\(\<,}])|(\s+as\s+))
end: (?=:)|(?=\s*([\(\<,}])|(\s+as|satisifies\s+))
patterns:
- include: '#comment'
- include: '#numeric-literal'
@ -1432,10 +1432,11 @@ repository:
'1': { name: keyword.control.as.ts }
'2': { name: storage.modifier.ts }
- name: meta.object.member.ts
begin: '{{startOfIdentifier}}(as)\s+'
begin: '{{startOfIdentifier}}(?:(as)|(satisfies))\s+'
beginCaptures:
'1': { name: keyword.control.as.ts }
end: (?={{lookAheadEndOfType}}|^|({{startOfIdentifier}}(as)\s+))
'2': { name: keyword.control.satisfies.ts }
end: (?={{lookAheadEndOfType}}|^|({{startOfIdentifier}}(as|satisifies)\s+))
patterns:
- include: '#type'
- name: meta.object.member.ts
@ -1712,10 +1713,11 @@ repository:
captures:
'1': { name: keyword.control.as.ts }
'2': { name: storage.modifier.ts }
- begin: '{{startOfIdentifier}}(as)\s+'
- begin: '{{startOfIdentifier}}(?:(as)|(satisfies))\s+'
beginCaptures:
'1': { name: keyword.control.as.ts }
end: (?=^|{{lookAheadEndOfType}}|({{startOfIdentifier}}(as)\s+)|(\s+\<))
'2': { name: keyword.control.satisfies.ts }
end: (?=^|{{lookAheadEndOfType}}|({{startOfIdentifier}}(as|satisifies)\s+)|(\s+\<))
patterns:
- include: '#type'
- name: keyword.operator.spread.ts

Просмотреть файл

@ -4427,7 +4427,7 @@
<key>begin</key>
<string>(?=[\'\"\`])</string>
<key>end</key>
<string>(?=:)|((?&lt;=[\'\"\`])(?=((\s*[\(\&lt;,}])|(\s+(as)\s+))))</string>
<string>(?=:)|((?&lt;=[\'\"\`])(?=((\s*[\(\&lt;,}])|(\s+(as|satisifies)\s+))))</string>
<key>patterns</key>
<array>
<dict>
@ -4455,7 +4455,7 @@
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
)(?!\$)))</string>
<key>end</key>
<string>(?=:)|(?=\s*([\(\&lt;,}])|(\s+as\s+))</string>
<string>(?=:)|(?=\s*([\(\&lt;,}])|(\s+as|satisifies\s+))</string>
<key>patterns</key>
<array>
<dict>
@ -4621,7 +4621,7 @@
<key>name</key>
<string>meta.object.member.ts</string>
<key>begin</key>
<string>(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(as)\s+</string>
<string>(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(?:(as)|(satisfies))\s+</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -4629,9 +4629,14 @@
<key>name</key>
<string>keyword.control.as.ts</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.satisfies.ts</string>
</dict>
</dict>
<key>end</key>
<string>(?=[;),}\]:?\-\+\&gt;]|\|\||\&amp;\&amp;|\!\=\=|$|^|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(as)\s+))</string>
<string>(?=[;),}\]:?\-\+\&gt;]|\|\||\&amp;\&amp;|\!\=\=|$|^|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(as|satisifies)\s+))</string>
<key>patterns</key>
<array>
<dict>
@ -5563,7 +5568,7 @@
</dict>
<dict>
<key>begin</key>
<string>(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(as)\s+</string>
<string>(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(?:(as)|(satisfies))\s+</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -5571,9 +5576,14 @@
<key>name</key>
<string>keyword.control.as.ts</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.satisfies.ts</string>
</dict>
</dict>
<key>end</key>
<string>(?=^|[;),}\]:?\-\+\&gt;]|\|\||\&amp;\&amp;|\!\=\=|$|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(as)\s+)|(\s+\&lt;))</string>
<string>(?=^|[;),}\]:?\-\+\&gt;]|\|\||\&amp;\&amp;|\!\=\=|$|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(as|satisifies)\s+)|(\s+\&lt;))</string>
<key>patterns</key>
<array>
<dict>

Просмотреть файл

@ -4449,7 +4449,7 @@
<key>begin</key>
<string>(?=[\'\"\`])</string>
<key>end</key>
<string>(?=:)|((?&lt;=[\'\"\`])(?=((\s*[\(\&lt;,}])|(\s+(as)\s+))))</string>
<string>(?=:)|((?&lt;=[\'\"\`])(?=((\s*[\(\&lt;,}])|(\s+(as|satisifies)\s+))))</string>
<key>patterns</key>
<array>
<dict>
@ -4477,7 +4477,7 @@
(?:\b[0-9][0-9_]*(n)?\b(?!\.)) # 1
)(?!\$)))</string>
<key>end</key>
<string>(?=:)|(?=\s*([\(\&lt;,}])|(\s+as\s+))</string>
<string>(?=:)|(?=\s*([\(\&lt;,}])|(\s+as|satisifies\s+))</string>
<key>patterns</key>
<array>
<dict>
@ -4645,7 +4645,7 @@
<key>name</key>
<string>meta.object.member.tsx</string>
<key>begin</key>
<string>(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(as)\s+</string>
<string>(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(?:(as)|(satisfies))\s+</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -4653,9 +4653,14 @@
<key>name</key>
<string>keyword.control.as.tsx</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.satisfies.tsx</string>
</dict>
</dict>
<key>end</key>
<string>(?=[;),}\]:?\-\+\&gt;]|\|\||\&amp;\&amp;|\!\=\=|$|^|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(as)\s+))</string>
<string>(?=[;),}\]:?\-\+\&gt;]|\|\||\&amp;\&amp;|\!\=\=|$|^|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(as|satisifies)\s+))</string>
<key>patterns</key>
<array>
<dict>
@ -5509,7 +5514,7 @@
</dict>
<dict>
<key>begin</key>
<string>(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(as)\s+</string>
<string>(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(?:(as)|(satisfies))\s+</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -5517,9 +5522,14 @@
<key>name</key>
<string>keyword.control.as.tsx</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.satisfies.tsx</string>
</dict>
</dict>
<key>end</key>
<string>(?=^|[;),}\]:?\-\+\&gt;]|\|\||\&amp;\&amp;|\!\=\=|$|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(as)\s+)|(\s+\&lt;))</string>
<string>(?=^|[;),}\]:?\-\+\&gt;]|\|\||\&amp;\&amp;|\!\=\=|$|((?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(as|satisifies)\s+)|(\s+\&lt;))</string>
<key>patterns</key>
<array>
<dict>

Просмотреть файл

@ -0,0 +1,36 @@
original file
-----------------------------------
let a = {} satisfies {};
-----------------------------------
Grammar: TypeScript.tmLanguage
-----------------------------------
>let a = {} satisfies {};
^^^
source.ts meta.var.expr.ts storage.type.ts
^
source.ts meta.var.expr.ts
^
source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.readwrite.ts
^
source.ts meta.var.expr.ts meta.var-single-variable.expr.ts
^
source.ts meta.var.expr.ts keyword.operator.assignment.ts
^
source.ts meta.var.expr.ts
^
source.ts meta.var.expr.ts meta.objectliteral.ts punctuation.definition.block.ts
^
source.ts meta.var.expr.ts meta.objectliteral.ts punctuation.definition.block.ts
^
source.ts meta.var.expr.ts
^^^^^^^^^
source.ts meta.var.expr.ts keyword.control.satisfies.ts
^
source.ts meta.var.expr.ts
^
source.ts meta.var.expr.ts meta.object.type.ts punctuation.definition.block.ts
^
source.ts meta.var.expr.ts meta.object.type.ts punctuation.definition.block.ts
^
source.ts punctuation.terminator.statement.ts

1
tests/cases/satisfies.ts Normal file
Просмотреть файл

@ -0,0 +1 @@
let a = {} satisfies {};