Fixes #1005
This commit is contained in:
Sheetal Nandi 2024-01-03 12:49:06 -08:00
Родитель 06a03eb510
Коммит b80b7509a7
5 изменённых файлов: 73 добавлений и 7 удалений

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

@ -1226,10 +1226,11 @@ repository:
- include: '#import-export-clause'
import-export-assert-clause:
begin: '{{startOfIdentifier}}(assert)\s*(\{)'
begin: '{{startOfIdentifier}}(?:(with)|(assert))\s*(\{)'
beginCaptures:
'1': { name: keyword.control.assert.ts }
'2': { name: punctuation.definition.block.ts }
'1': { name: keyword.control.with.ts }
'2': { name: keyword.control.assert.ts }
'3': { name: punctuation.definition.block.ts }
end: \}
endCaptures:
'0': { name: punctuation.definition.block.ts }

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

@ -3923,15 +3923,20 @@
<key>import-export-assert-clause</key>
<dict>
<key>begin</key>
<string>(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(assert)\s*(\{)</string>
<string>(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(?:(with)|(assert))\s*(\{)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.assert.ts</string>
<string>keyword.control.with.ts</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.assert.ts</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>punctuation.definition.block.ts</string>

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

@ -3945,15 +3945,20 @@
<key>import-export-assert-clause</key>
<dict>
<key>begin</key>
<string>(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(assert)\s*(\{)</string>
<string>(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(?:(with)|(assert))\s*(\{)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.assert.tsx</string>
<string>keyword.control.with.tsx</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>keyword.control.assert.tsx</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>punctuation.definition.block.tsx</string>

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

@ -0,0 +1,54 @@
original file
-----------------------------------
import foo from "./foo.json" with { type: "json" };
-----------------------------------
Grammar: TypeScript.tmLanguage
-----------------------------------
>import foo from "./foo.json" with { type: "json" };
^^^^^^
source.ts meta.import.ts keyword.control.import.ts
^
source.ts meta.import.ts
^^^
source.ts meta.import.ts variable.other.readwrite.alias.ts
^
source.ts meta.import.ts
^^^^
source.ts meta.import.ts keyword.control.from.ts
^
source.ts meta.import.ts
^
source.ts meta.import.ts string.quoted.double.ts punctuation.definition.string.begin.ts
^^^^^^^^^^
source.ts meta.import.ts string.quoted.double.ts
^
source.ts meta.import.ts string.quoted.double.ts punctuation.definition.string.end.ts
^
source.ts meta.import.ts
^^^^
source.ts meta.import.ts keyword.control.with.ts
^
source.ts meta.import.ts
^
source.ts meta.import.ts punctuation.definition.block.ts
^
source.ts meta.import.ts
^^^^
source.ts meta.import.ts meta.object-literal.key.ts
^
source.ts meta.import.ts punctuation.separator.key-value.ts
^
source.ts meta.import.ts
^
source.ts meta.import.ts string.quoted.double.ts punctuation.definition.string.begin.ts
^^^^
source.ts meta.import.ts string.quoted.double.ts
^
source.ts meta.import.ts string.quoted.double.ts punctuation.definition.string.end.ts
^
source.ts meta.import.ts
^
source.ts meta.import.ts punctuation.definition.block.ts
^
source.ts punctuation.terminator.statement.ts

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

@ -0,0 +1 @@
import foo from "./foo.json" with { type: "json" };