Correct the import/export matching to exclude \*|default from as clause.
Fixes #531
This commit is contained in:
Родитель
4109ddc9e2
Коммит
f3a2069b99
|
@ -860,17 +860,14 @@ repository:
|
|||
import-export-clause:
|
||||
patterns:
|
||||
- include: '#comment'
|
||||
- comment: (default|*|name) as alias
|
||||
match: |-
|
||||
(?x) (?: \b(default)\b | (\*) | ({{identifier}})) \s+
|
||||
(as) \s+ (?: (\b default \b | \*) | ({{identifier}}))
|
||||
#(default|*|name) as alias
|
||||
- match: (?<!\.|\$)(?:(\bdefault)|(\*)|(\b{{identifier}}))\s+(as)\s+(\b{{identifier}})
|
||||
captures:
|
||||
'1': { name: keyword.control.default.ts }
|
||||
'2': { name: constant.language.import-export-all.ts }
|
||||
'3': { name: variable.other.readwrite.ts }
|
||||
'4': { name: keyword.control.as.ts }
|
||||
'5': { name: invalid.illegal.ts }
|
||||
'6': { name: variable.other.readwrite.alias.ts }
|
||||
'5': { name: variable.other.readwrite.alias.ts }
|
||||
- include: '#punctuation-comma'
|
||||
- name: constant.language.import-export-all.ts
|
||||
match: \*
|
||||
|
|
|
@ -2703,11 +2703,8 @@
|
|||
<string>#comment</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>comment</key>
|
||||
<string>(default|*|name) as alias</string>
|
||||
<key>match</key>
|
||||
<string>(?x) (?: \b(default)\b | (\*) | ([_$[:alpha:]][_$[:alnum:]]*)) \s+
|
||||
(as) \s+ (?: (\b default \b | \*) | ([_$[:alpha:]][_$[:alnum:]]*))</string>
|
||||
<string>(?<!\.|\$)(?:(\bdefault)|(\*)|(\b[_$[:alpha:]][_$[:alnum:]]*))\s+(as)\s+(\b[_$[:alpha:]][_$[:alnum:]]*)</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
|
@ -2731,11 +2728,6 @@
|
|||
<string>keyword.control.as.ts</string>
|
||||
</dict>
|
||||
<key>5</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>invalid.illegal.ts</string>
|
||||
</dict>
|
||||
<key>6</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.readwrite.alias.ts</string>
|
||||
|
|
|
@ -2707,11 +2707,8 @@
|
|||
<string>#comment</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>comment</key>
|
||||
<string>(default|*|name) as alias</string>
|
||||
<key>match</key>
|
||||
<string>(?x) (?: \b(default)\b | (\*) | ([_$[:alpha:]][_$[:alnum:]]*)) \s+
|
||||
(as) \s+ (?: (\b default \b | \*) | ([_$[:alpha:]][_$[:alnum:]]*))</string>
|
||||
<string>(?<!\.|\$)(?:(\bdefault)|(\*)|(\b[_$[:alpha:]][_$[:alnum:]]*))\s+(as)\s+(\b[_$[:alpha:]][_$[:alnum:]]*)</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
|
@ -2735,11 +2732,6 @@
|
|||
<string>keyword.control.as.tsx</string>
|
||||
</dict>
|
||||
<key>5</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>invalid.illegal.tsx</string>
|
||||
</dict>
|
||||
<key>6</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.readwrite.alias.tsx</string>
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
original file
|
||||
-----------------------------------
|
||||
class Test { }
|
||||
export {
|
||||
Test as default
|
||||
};
|
||||
-----------------------------------
|
||||
|
||||
Grammar: TypeScript.tmLanguage
|
||||
-----------------------------------
|
||||
>class Test { }
|
||||
^^^^^
|
||||
source.ts meta.class.ts storage.type.class.ts
|
||||
^
|
||||
source.ts meta.class.ts
|
||||
^^^^
|
||||
source.ts meta.class.ts entity.name.type.class.ts
|
||||
^
|
||||
source.ts meta.class.ts
|
||||
^
|
||||
source.ts meta.class.ts punctuation.definition.block.ts
|
||||
^
|
||||
source.ts meta.class.ts
|
||||
^
|
||||
source.ts meta.class.ts punctuation.definition.block.ts
|
||||
^^
|
||||
source.ts
|
||||
>export {
|
||||
^^^^^^
|
||||
source.ts meta.export.ts keyword.control.export.ts
|
||||
^
|
||||
source.ts meta.export.ts
|
||||
^
|
||||
source.ts meta.export.ts meta.block.ts punctuation.definition.block.ts
|
||||
^^
|
||||
source.ts meta.export.ts meta.block.ts
|
||||
> Test as default
|
||||
^
|
||||
source.ts meta.export.ts meta.block.ts
|
||||
^^^^
|
||||
source.ts meta.export.ts meta.block.ts variable.other.readwrite.ts
|
||||
^
|
||||
source.ts meta.export.ts meta.block.ts
|
||||
^^
|
||||
source.ts meta.export.ts meta.block.ts keyword.control.as.ts
|
||||
^
|
||||
source.ts meta.export.ts meta.block.ts
|
||||
^^^^^^^
|
||||
source.ts meta.export.ts meta.block.ts variable.other.readwrite.alias.ts
|
||||
^^
|
||||
source.ts meta.export.ts meta.block.ts
|
||||
>};
|
||||
^
|
||||
source.ts meta.export.ts meta.block.ts punctuation.definition.block.ts
|
||||
^
|
||||
source.ts punctuation.terminator.statement.ts
|
|
@ -0,0 +1,4 @@
|
|||
class Test { }
|
||||
export {
|
||||
Test as default
|
||||
};
|
Загрузка…
Ссылка в новой задаче