Scope the complete function call instead of just method/function call to make sure they dont get confused with arrows
Fixes #397
This commit is contained in:
Родитель
603284f358
Коммит
d128c369d5
|
@ -1363,11 +1363,12 @@ repository:
|
|||
'4': { name: support.function.dom.ts }
|
||||
|
||||
function-call:
|
||||
begin: (?=(\.\s*)?([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()
|
||||
end: (?<=\))(?!(\.\s*)?([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()
|
||||
begin: (?=(([_$[:alpha:]][_$[:alnum:]]*\s*\.\s*)*|(\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()
|
||||
end: (?<=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\.\s*)*|(\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()
|
||||
patterns:
|
||||
- include: '#literal'
|
||||
- include: '#support-objects'
|
||||
- include: '#object-identifiers'
|
||||
- include: '#punctuation-accessor'
|
||||
- name: entity.name.function.ts
|
||||
match: ([_$[:alpha:]][_$[:alnum:]]*)
|
||||
|
@ -1386,19 +1387,7 @@ repository:
|
|||
|
||||
identifiers:
|
||||
patterns:
|
||||
# class
|
||||
- name: support.class.ts
|
||||
match: ([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\.\s*prototype\b(?!\$))
|
||||
# object properties
|
||||
- match: |-
|
||||
(?x)(\.)\s*(?:
|
||||
([[:upper:]][_$[:digit:][:upper:]]*) |
|
||||
([_$[:alpha:]][_$[:alnum:]]*)
|
||||
)(?=\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)
|
||||
captures:
|
||||
'1': { name: punctuation.accessor.ts }
|
||||
'2': { name: variable.other.constant.object.property.ts }
|
||||
'3': { name: variable.other.object.property.ts }
|
||||
- include: '#object-identifiers'
|
||||
# function and method assignment
|
||||
- match: |-
|
||||
(?x)(?:(\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*)(?=\s*=\s*(
|
||||
|
@ -1420,6 +1409,28 @@ repository:
|
|||
captures:
|
||||
'1': { name: punctuation.accessor.ts }
|
||||
'2': { name: variable.other.property.ts }
|
||||
# const
|
||||
- name: variable.other.constant.ts
|
||||
match: ([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])
|
||||
# vars
|
||||
- name: variable.other.readwrite.ts
|
||||
match: '[_$[:alpha:]][_$[:alnum:]]*'
|
||||
|
||||
object-identifiers:
|
||||
patterns:
|
||||
# class
|
||||
- name: support.class.ts
|
||||
match: ([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\.\s*prototype\b(?!\$))
|
||||
# object properties
|
||||
- match: |-
|
||||
(?x)(\.)\s*(?:
|
||||
([[:upper:]][_$[:digit:][:upper:]]*) |
|
||||
([_$[:alpha:]][_$[:alnum:]]*)
|
||||
)(?=\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)
|
||||
captures:
|
||||
'1': { name: punctuation.accessor.ts }
|
||||
'2': { name: variable.other.constant.object.property.ts }
|
||||
'3': { name: variable.other.object.property.ts }
|
||||
# objects
|
||||
- match: |-
|
||||
(?x)(?:
|
||||
|
@ -1429,12 +1440,6 @@ repository:
|
|||
captures:
|
||||
'1': { name: variable.other.constant.object.ts }
|
||||
'2': { name: variable.other.object.ts }
|
||||
# const
|
||||
- name: variable.other.constant.ts
|
||||
match: ([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])
|
||||
# vars
|
||||
- name: variable.other.readwrite.ts
|
||||
match: '[_$[:alpha:]][_$[:alnum:]]*'
|
||||
|
||||
cast:
|
||||
name: cast.expr.ts
|
||||
|
|
|
@ -3757,9 +3757,9 @@
|
|||
<key>function-call</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(?=(\.\s*)?([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()</string>
|
||||
<string>(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\.\s*)*|(\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()</string>
|
||||
<key>end</key>
|
||||
<string>(?<=\))(?!(\.\s*)?([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()</string>
|
||||
<string>(?<=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\.\s*)*|(\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
@ -3770,6 +3770,10 @@
|
|||
<key>include</key>
|
||||
<string>#support-objects</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#object-identifiers</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#punctuation-accessor</string>
|
||||
|
@ -3830,35 +3834,8 @@
|
|||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>support.class.ts</string>
|
||||
<key>match</key>
|
||||
<string>([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\.\s*prototype\b(?!\$))</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>(?x)(\.)\s*(?:
|
||||
([[:upper:]][_$[:digit:][:upper:]]*) |
|
||||
([_$[:alpha:]][_$[:alnum:]]*)
|
||||
)(?=\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.accessor.ts</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.constant.object.property.ts</string>
|
||||
</dict>
|
||||
<key>3</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.object.property.ts</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>include</key>
|
||||
<string>#object-identifiers</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
|
@ -3916,6 +3893,55 @@
|
|||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.constant.ts</string>
|
||||
<key>match</key>
|
||||
<string>([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.readwrite.ts</string>
|
||||
<key>match</key>
|
||||
<string>[_$[:alpha:]][_$[:alnum:]]*</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>object-identifiers</key>
|
||||
<dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>support.class.ts</string>
|
||||
<key>match</key>
|
||||
<string>([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\.\s*prototype\b(?!\$))</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>(?x)(\.)\s*(?:
|
||||
([[:upper:]][_$[:digit:][:upper:]]*) |
|
||||
([_$[:alpha:]][_$[:alnum:]]*)
|
||||
)(?=\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.accessor.ts</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.constant.object.property.ts</string>
|
||||
</dict>
|
||||
<key>3</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.object.property.ts</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>(?x)(?:
|
||||
|
@ -3936,18 +3962,6 @@
|
|||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.constant.ts</string>
|
||||
<key>match</key>
|
||||
<string>([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.readwrite.ts</string>
|
||||
<key>match</key>
|
||||
<string>[_$[:alpha:]][_$[:alnum:]]*</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>cast</key>
|
||||
|
|
|
@ -3761,9 +3761,9 @@
|
|||
<key>function-call</key>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(?=(\.\s*)?([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()</string>
|
||||
<string>(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\.\s*)*|(\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()</string>
|
||||
<key>end</key>
|
||||
<string>(?<=\))(?!(\.\s*)?([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()</string>
|
||||
<string>(?<=\))(?!(([_$[:alpha:]][_$[:alnum:]]*\s*\.\s*)*|(\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)\s*(<([^<>]|\<[^<>]+\>)+>\s*)?\()</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
@ -3774,6 +3774,10 @@
|
|||
<key>include</key>
|
||||
<string>#support-objects</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#object-identifiers</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#punctuation-accessor</string>
|
||||
|
@ -3834,35 +3838,8 @@
|
|||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>support.class.tsx</string>
|
||||
<key>match</key>
|
||||
<string>([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\.\s*prototype\b(?!\$))</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>(?x)(\.)\s*(?:
|
||||
([[:upper:]][_$[:digit:][:upper:]]*) |
|
||||
([_$[:alpha:]][_$[:alnum:]]*)
|
||||
)(?=\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.accessor.tsx</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.constant.object.property.tsx</string>
|
||||
</dict>
|
||||
<key>3</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.object.property.tsx</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>include</key>
|
||||
<string>#object-identifiers</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
|
@ -3920,6 +3897,55 @@
|
|||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.constant.tsx</string>
|
||||
<key>match</key>
|
||||
<string>([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.readwrite.tsx</string>
|
||||
<key>match</key>
|
||||
<string>[_$[:alpha:]][_$[:alnum:]]*</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>object-identifiers</key>
|
||||
<dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>support.class.tsx</string>
|
||||
<key>match</key>
|
||||
<string>([_$[:alpha:]][_$[:alnum:]]*)(?=\s*\.\s*prototype\b(?!\$))</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>(?x)(\.)\s*(?:
|
||||
([[:upper:]][_$[:digit:][:upper:]]*) |
|
||||
([_$[:alpha:]][_$[:alnum:]]*)
|
||||
)(?=\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.accessor.tsx</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.constant.object.property.tsx</string>
|
||||
</dict>
|
||||
<key>3</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.object.property.tsx</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>(?x)(?:
|
||||
|
@ -3940,18 +3966,6 @@
|
|||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.constant.tsx</string>
|
||||
<key>match</key>
|
||||
<string>([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>variable.other.readwrite.tsx</string>
|
||||
<key>match</key>
|
||||
<string>[_$[:alpha:]][_$[:alnum:]]*</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<key>cast</key>
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
original file
|
||||
-----------------------------------
|
||||
const a = Math.max(...x);
|
||||
const b = 2;
|
||||
-----------------------------------
|
||||
|
||||
Grammar: TypeScript.tmLanguage
|
||||
-----------------------------------
|
||||
>const a = Math.max(...x);
|
||||
^^^^^
|
||||
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 support.constant.math.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts punctuation.accessor.ts
|
||||
^^^
|
||||
source.ts meta.var.expr.ts support.function.math.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.brace.round.ts
|
||||
^^^
|
||||
source.ts meta.var.expr.ts keyword.operator.spread.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts variable.other.readwrite.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.brace.round.ts
|
||||
^
|
||||
source.ts punctuation.terminator.statement.ts
|
||||
^^
|
||||
source.ts
|
||||
>const b = 2;
|
||||
^^^^^
|
||||
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 constant.numeric.decimal.ts
|
||||
^
|
||||
source.ts punctuation.terminator.statement.ts
|
|
@ -0,0 +1,2 @@
|
|||
const a = Math.max(...x);
|
||||
const b = 2;
|
Загрузка…
Ссылка в новой задаче