Родитель
de11c82f7c
Коммит
60cc32899e
|
@ -33,6 +33,7 @@ variables:
|
|||
matchingBrackets: (\[([^\[\]]|(\[[^\[\]]*\]))*\])
|
||||
inlineComment: \/\*([^\*]|(\*[^\/]))*\*\/
|
||||
lookBehindOfPossiblyMultilineArrow: (?<=[(=,]|=>)
|
||||
lookBehindOfObjectMemberPossiblyMultilineArrow: (?<=:)
|
||||
# Identifier start | matching braces | matching parenthesis | matching square brackets
|
||||
typeParamersStart: ([_$[:alpha:]]|{{matchingBraces}}|{{matchingParenthesis}}|{{matchingBrackets}})
|
||||
typeParameters: (<\s*{{typeParamersStart}}([^=<>]|=[^<]|\<\s*{{typeParamersStart}}([^=<>]|=[^<])*\>)*>\s*)
|
||||
|
@ -1113,6 +1114,29 @@ repository:
|
|||
'0': { name: meta.object-literal.key.ts punctuation.separator.key-value.ts }
|
||||
end: (?=,|\})
|
||||
patterns:
|
||||
- begin: '{{lookBehindOfObjectMemberPossiblyMultilineArrow}}\s*(async)?(?=\s*{{typeParameters}}\(\s*$)'
|
||||
beginCaptures:
|
||||
'1': { name: storage.modifier.async.ts }
|
||||
end: (?<=\))
|
||||
patterns:
|
||||
- include: '#type-parameters'
|
||||
- begin: \(
|
||||
beginCaptures:
|
||||
'0': { name: meta.brace.round.ts }
|
||||
end: \)
|
||||
endCaptures:
|
||||
'0': { name: meta.brace.round.ts }
|
||||
patterns:
|
||||
- include: '#expression-inside-possibly-arrow-parens'
|
||||
- begin: '{{lookBehindOfObjectMemberPossiblyMultilineArrow}}\s*(async)?\s*(\()(?=\s*$)'
|
||||
beginCaptures:
|
||||
'1': { name: storage.modifier.async.ts }
|
||||
'2': { name: meta.brace.round.ts }
|
||||
end: \)
|
||||
endCaptures:
|
||||
'0': { name: meta.brace.round.ts }
|
||||
patterns:
|
||||
- include: '#expression-inside-possibly-arrow-parens'
|
||||
- include: '#expression'
|
||||
- include: '#punctuation-comma'
|
||||
|
||||
|
|
|
@ -3492,6 +3492,90 @@
|
|||
<string>(?=,|\})</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)\(\s*$)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>storage.modifier.async.ts</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>(?<=\))</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#type-parameters</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>\(</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.brace.round.ts</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>\)</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.brace.round.ts</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expression-inside-possibly-arrow-parens</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(?<=:)\s*(async)?\s*(\()(?=\s*$)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>storage.modifier.async.ts</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.brace.round.ts</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>\)</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.brace.round.ts</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expression-inside-possibly-arrow-parens</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expression</string>
|
||||
|
|
|
@ -3496,6 +3496,90 @@
|
|||
<string>(?=,|\})</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(?<=:)\s*(async)?(?=\s*(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*>\s*)\(\s*$)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>storage.modifier.async.tsx</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>(?<=\))</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#type-parameters</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>\(</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.brace.round.tsx</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>\)</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.brace.round.tsx</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expression-inside-possibly-arrow-parens</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(?<=:)\s*(async)?\s*(\()(?=\s*$)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>storage.modifier.async.tsx</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.brace.round.tsx</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>\)</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.brace.round.tsx</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expression-inside-possibly-arrow-parens</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>#expression</string>
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
original file
|
||||
-----------------------------------
|
||||
const a = {
|
||||
x: (y: string) => {}
|
||||
};
|
||||
|
||||
const b = {
|
||||
x: (
|
||||
y: string
|
||||
) => {}
|
||||
};
|
||||
-----------------------------------
|
||||
|
||||
Grammar: TypeScript.tmLanguage
|
||||
-----------------------------------
|
||||
>const a = {
|
||||
^^^^^
|
||||
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 meta.objectliteral.ts punctuation.definition.block.ts
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts
|
||||
> x: (y: string) => {}
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.object-literal.key.ts entity.name.function.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.object-literal.key.ts punctuation.separator.key-value.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts meta.parameters.ts variable.parameter.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts meta.parameters.ts meta.type.annotation.ts
|
||||
^^^^^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts meta.parameters.ts meta.type.annotation.ts support.type.primitive.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.end.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts storage.type.function.arrow.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts
|
||||
>};
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts punctuation.definition.block.ts
|
||||
^
|
||||
source.ts punctuation.terminator.statement.ts
|
||||
^^
|
||||
source.ts
|
||||
>
|
||||
^^
|
||||
source.ts
|
||||
>const b = {
|
||||
^^^^^
|
||||
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 meta.objectliteral.ts punctuation.definition.block.ts
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts
|
||||
> x: (
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.object-literal.key.ts entity.name.function.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.object-literal.key.ts punctuation.separator.key-value.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.brace.round.ts
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts
|
||||
> y: string
|
||||
^^^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts variable.parameter.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.type.annotation.ts
|
||||
^^^^^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.type.annotation.ts support.type.primitive.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.type.annotation.ts
|
||||
> ) => {}
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.brace.round.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts storage.type.function.arrow.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts
|
||||
^^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts meta.object.member.ts
|
||||
>};
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts punctuation.definition.block.ts
|
||||
^
|
||||
source.ts punctuation.terminator.statement.ts
|
|
@ -0,0 +1,9 @@
|
|||
const a = {
|
||||
x: (y: string) => {}
|
||||
};
|
||||
|
||||
const b = {
|
||||
x: (
|
||||
y: string
|
||||
) => {}
|
||||
};
|
Загрузка…
Ссылка в новой задаче