Add 'abstract' constructor types (#861)
This commit is contained in:
Родитель
dcfca7bda0
Коммит
10e222a5ac
|
@ -2443,17 +2443,19 @@ repository:
|
|||
type-fn-type-parameters:
|
||||
patterns:
|
||||
# constructor type
|
||||
- begin: '{{startOfIdentifier}}(new)\b(?=\s*\<)'
|
||||
- begin: '{{startOfIdentifier}}(?:(abstract)\s+)?(new)\b(?=\s*\<)'
|
||||
beginCaptures:
|
||||
'1': { name: meta.type.constructor.ts keyword.control.new.ts }
|
||||
'1': { name: meta.type.constructor.ts storage.modifier.ts } # captures keyword (abstract)
|
||||
'2': { name: meta.type.constructor.ts keyword.control.new.ts } # captures keyword (new)
|
||||
end: (?<=>)
|
||||
patterns:
|
||||
- include: '#comment'
|
||||
- include: '#type-parameters'
|
||||
- name: meta.type.constructor.ts
|
||||
begin: '{{startOfIdentifier}}(new)\b\s*(?=\()'
|
||||
begin: '{{startOfIdentifier}}(?:(abstract)\s+)?(new)\b\s*(?=\()'
|
||||
beginCaptures:
|
||||
'1': { name: keyword.control.new.ts }
|
||||
'1': { name: storage.modifier.ts } # captures keyword (abstract)
|
||||
'2': { name: keyword.control.new.ts } # captures keyword (new)
|
||||
end: (?<=\))
|
||||
patterns:
|
||||
- include: '#function-parameters'
|
||||
|
|
|
@ -7424,10 +7424,15 @@
|
|||
<array>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b(?=\s*\<)</string>
|
||||
<string>(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b(?=\s*\<)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.type.constructor.ts storage.modifier.ts</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.type.constructor.ts keyword.control.new.ts</string>
|
||||
|
@ -7451,10 +7456,15 @@
|
|||
<key>name</key>
|
||||
<string>meta.type.constructor.ts</string>
|
||||
<key>begin</key>
|
||||
<string>(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b\s*(?=\()</string>
|
||||
<string>(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b\s*(?=\()</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>storage.modifier.ts</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.control.new.ts</string>
|
||||
|
|
|
@ -7372,10 +7372,15 @@
|
|||
<array>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b(?=\s*\<)</string>
|
||||
<string>(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b(?=\s*\<)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.type.constructor.tsx storage.modifier.tsx</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.type.constructor.tsx keyword.control.new.tsx</string>
|
||||
|
@ -7399,10 +7404,15 @@
|
|||
<key>name</key>
|
||||
<string>meta.type.constructor.tsx</string>
|
||||
<key>begin</key>
|
||||
<string>(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(new)\b\s*(?=\()</string>
|
||||
<string>(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(abstract)\s+)?(new)\b\s*(?=\()</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>storage.modifier.tsx</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.control.new.tsx</string>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
original file
|
||||
-----------------------------------
|
||||
type constructorType<T> = new <T>(a: T) => T;
|
||||
type abstractConstructorType<T> = abstract new <T>(a: T) => T;
|
||||
-----------------------------------
|
||||
|
||||
Grammar: TypeScript.tmLanguage
|
||||
|
@ -55,4 +56,59 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.type.declaration.ts meta.type.function.return.ts entity.name.type.ts
|
||||
^
|
||||
source.ts punctuation.terminator.statement.ts
|
||||
source.ts punctuation.terminator.statement.ts
|
||||
>type abstractConstructorType<T> = abstract new <T>(a: T) => T;
|
||||
^^^^
|
||||
source.ts meta.type.declaration.ts storage.type.type.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
source.ts meta.type.declaration.ts entity.name.type.alias.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.parameters.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts keyword.operator.assignment.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts
|
||||
^^^^^^^^
|
||||
source.ts meta.type.declaration.ts meta.type.constructor.ts storage.modifier.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts
|
||||
^^^
|
||||
source.ts meta.type.declaration.ts meta.type.constructor.ts keyword.control.new.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.parameters.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.function.ts meta.parameters.ts variable.parameter.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.function.ts meta.parameters.ts meta.type.annotation.ts entity.name.type.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts
|
||||
^^
|
||||
source.ts meta.type.declaration.ts meta.type.function.return.ts storage.type.function.arrow.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.function.return.ts
|
||||
^
|
||||
source.ts meta.type.declaration.ts meta.type.function.return.ts entity.name.type.ts
|
||||
^
|
||||
source.ts punctuation.terminator.statement.ts
|
|
@ -1 +1,2 @@
|
|||
type constructorType<T> = new <T>(a: T) => T;
|
||||
type constructorType<T> = new <T>(a: T) => T;
|
||||
type abstractConstructorType<T> = abstract new <T>(a: T) => T;
|
Загрузка…
Ссылка в новой задаче