Родитель
06831946d0
Коммит
1d2625adfc
|
@ -125,6 +125,12 @@ repository:
|
|||
match: (?<!\.|\$)\b(declare)\b(?!\$|\.)
|
||||
|
||||
expression:
|
||||
patterns:
|
||||
- include: '#expressionWithoutIdentifiers'
|
||||
- include: '#identifiers'
|
||||
- include: '#expressionPunctuations'
|
||||
|
||||
expressionWithoutIdentifiers:
|
||||
patterns:
|
||||
- include: '#string'
|
||||
- include: '#regex'
|
||||
|
@ -141,8 +147,10 @@ repository:
|
|||
- include: '#function-call'
|
||||
- include: '#literal'
|
||||
- include: '#support-objects'
|
||||
- include: '#identifiers'
|
||||
- include: '#paren-expression'
|
||||
|
||||
expressionPunctuations:
|
||||
patterns:
|
||||
- include: '#punctuation-comma'
|
||||
- include: '#punctuation-accessor'
|
||||
|
||||
|
@ -658,20 +666,22 @@ repository:
|
|||
beginCaptures:
|
||||
'1': { name: storage.modifier.ts }
|
||||
end: (?=\{)
|
||||
endCaptures:
|
||||
'1': { name: punctuation.definition.block.ts }
|
||||
patterns:
|
||||
- include: '#comment'
|
||||
- include: '#class-or-interface-heritage'
|
||||
- include: '#type-parameters'
|
||||
- match: ({{identifier}})\s*(\.)(?=\s*{{identifier}}(\s*\.\s*{{identifier}})*\s*([,<{]|extends|implements|//|/\*))
|
||||
# match expressions before matching identifiers
|
||||
- include: '#expressionWithoutIdentifiers'
|
||||
# identifiers are treated as inherited class
|
||||
- match: ({{identifier}})\s*(\.)(?=\s*{{identifier}}(\s*\.\s*{{identifier}})*\s*)
|
||||
captures:
|
||||
'1': { name: entity.name.type.module.ts }
|
||||
'2': { name: punctuation.accessor.ts }
|
||||
- match: ({{identifier}})(?=\s*([,<{]|extends|implements|//|/\*))
|
||||
- match: ({{identifier}})
|
||||
captures:
|
||||
'1': { name: entity.other.inherited-class.ts }
|
||||
- include: '#expression'
|
||||
# match punctuations of the expression
|
||||
- include: '#expressionPunctuations'
|
||||
|
||||
class-or-interface-body:
|
||||
begin: \{
|
||||
|
|
|
@ -194,6 +194,24 @@
|
|||
</array>
|
||||
</dict>
|
||||
<key>expression</key>
|
||||
<dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expressionWithoutIdentifiers</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#identifiers</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expressionPunctuations</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>expressionWithoutIdentifiers</key>
|
||||
<dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
|
@ -257,14 +275,16 @@
|
|||
<key>include</key>
|
||||
<string>#support-objects</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#identifiers</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#paren-expression</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>expressionPunctuations</key>
|
||||
<dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#punctuation-comma</string>
|
||||
|
@ -2009,14 +2029,6 @@
|
|||
</dict>
|
||||
<key>end</key>
|
||||
<string>(?=\{)</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.block.ts</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
@ -2031,9 +2043,13 @@
|
|||
<key>include</key>
|
||||
<string>#type-parameters</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expressionWithoutIdentifiers</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(\.)(?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)*\s*([,<{]|extends|implements|//|/\*))</string>
|
||||
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(\.)(?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)*\s*)</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
|
@ -2050,7 +2066,7 @@
|
|||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>([_$[:alpha:]][_$[:alnum:]]*)(?=\s*([,<{]|extends|implements|//|/\*))</string>
|
||||
<string>([_$[:alpha:]][_$[:alnum:]]*)</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
|
@ -2062,7 +2078,7 @@
|
|||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expression</string>
|
||||
<string>#expressionPunctuations</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
|
|
|
@ -11,7 +11,7 @@ uuid: 805375ec-d614-41f5-8993-5843fe63ea82
|
|||
repository:
|
||||
# Additions:
|
||||
# expression repository need to include jsx first followed by whaterver ts grammar says
|
||||
expression:
|
||||
expressionWithoutIdentifiers:
|
||||
patterns:
|
||||
- include: '#jsx'
|
||||
|
||||
|
|
|
@ -194,6 +194,24 @@
|
|||
</array>
|
||||
</dict>
|
||||
<key>expression</key>
|
||||
<dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expressionWithoutIdentifiers</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#identifiers</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expressionPunctuations</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>expressionWithoutIdentifiers</key>
|
||||
<dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
|
@ -261,14 +279,16 @@
|
|||
<key>include</key>
|
||||
<string>#support-objects</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#identifiers</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#paren-expression</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>expressionPunctuations</key>
|
||||
<dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#punctuation-comma</string>
|
||||
|
@ -2013,14 +2033,6 @@
|
|||
</dict>
|
||||
<key>end</key>
|
||||
<string>(?=\{)</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.block.tsx</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
@ -2035,9 +2047,13 @@
|
|||
<key>include</key>
|
||||
<string>#type-parameters</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expressionWithoutIdentifiers</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(\.)(?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)*\s*([,<{]|extends|implements|//|/\*))</string>
|
||||
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(\.)(?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)*\s*)</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
|
@ -2054,7 +2070,7 @@
|
|||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>([_$[:alpha:]][_$[:alnum:]]*)(?=\s*([,<{]|extends|implements|//|/\*))</string>
|
||||
<string>([_$[:alpha:]][_$[:alnum:]]*)</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
|
@ -2066,7 +2082,7 @@
|
|||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expression</string>
|
||||
<string>#expressionPunctuations</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
|
|
|
@ -57,7 +57,7 @@ function changeTsToTsxGrammar(grammar: any) {
|
|||
const updatesRepository = tsxUpdates.repository;
|
||||
for (let key in updatesRepository) {
|
||||
switch(key) {
|
||||
case "expression":
|
||||
case "expressionWithoutIdentifiers":
|
||||
// Update expression
|
||||
repository[key].patterns.unshift(updatesRepository[key].patterns[0]);
|
||||
break;
|
||||
|
|
|
@ -1479,7 +1479,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.interface.ts
|
||||
^^^^^
|
||||
source.ts meta.interface.ts entity.other.inherited-class.ts
|
||||
source.ts meta.interface.ts support.class.builtin.ts
|
||||
^
|
||||
source.ts meta.interface.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
|
||||
^
|
||||
|
@ -1554,7 +1554,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.interface.ts
|
||||
^^^^^
|
||||
source.ts meta.interface.ts entity.other.inherited-class.ts
|
||||
source.ts meta.interface.ts support.class.builtin.ts
|
||||
^
|
||||
source.ts meta.interface.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
|
||||
^
|
||||
|
@ -1629,7 +1629,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^^
|
||||
source.ts meta.interface.ts comment.block.ts punctuation.definition.comment.ts
|
||||
^^^^^
|
||||
source.ts meta.interface.ts entity.other.inherited-class.ts
|
||||
source.ts meta.interface.ts support.class.builtin.ts
|
||||
^
|
||||
source.ts meta.interface.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
|
||||
^
|
||||
|
@ -1702,7 +1702,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.interface.ts
|
||||
^^^^^
|
||||
source.ts meta.interface.ts entity.other.inherited-class.ts
|
||||
source.ts meta.interface.ts support.class.builtin.ts
|
||||
^^
|
||||
source.ts meta.interface.ts comment.block.ts punctuation.definition.comment.ts
|
||||
^^
|
||||
|
@ -1779,7 +1779,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.interface.ts
|
||||
^^^^^
|
||||
source.ts meta.interface.ts entity.other.inherited-class.ts
|
||||
source.ts meta.interface.ts support.class.builtin.ts
|
||||
^
|
||||
source.ts meta.interface.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
|
||||
^
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
original file
|
||||
-----------------------------------
|
||||
class a extends b, c {
|
||||
}
|
||||
class a2 extends b, c
|
||||
{
|
||||
}
|
||||
-----------------------------------
|
||||
|
||||
Grammar: TypeScript.tmLanguage
|
||||
-----------------------------------
|
||||
>class a extends b, c {
|
||||
^^^^^
|
||||
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 storage.modifier.ts
|
||||
^
|
||||
source.ts meta.class.ts
|
||||
^
|
||||
source.ts meta.class.ts entity.other.inherited-class.ts
|
||||
^
|
||||
source.ts meta.class.ts punctuation.separator.comma.ts
|
||||
^
|
||||
source.ts meta.class.ts
|
||||
^
|
||||
source.ts meta.class.ts entity.other.inherited-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
|
||||
>class a2 extends b, c
|
||||
^^^^^
|
||||
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 storage.modifier.ts
|
||||
^
|
||||
source.ts meta.class.ts
|
||||
^
|
||||
source.ts meta.class.ts entity.other.inherited-class.ts
|
||||
^
|
||||
source.ts meta.class.ts punctuation.separator.comma.ts
|
||||
^
|
||||
source.ts meta.class.ts
|
||||
^
|
||||
source.ts meta.class.ts entity.other.inherited-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
|
|
@ -0,0 +1,5 @@
|
|||
class a extends b, c {
|
||||
}
|
||||
class a2 extends b, c
|
||||
{
|
||||
}
|
Загрузка…
Ссылка в новой задаче