Fix the end of variable initializer to be anything but \s and =
Cast expression is now consuming trailing spaces Fixes #463
This commit is contained in:
Родитель
947bc2edaa
Коммит
16fb0e70e3
|
@ -1078,7 +1078,7 @@ repository:
|
|||
- begin: (?<!=|!)(=)(?!=)
|
||||
beginCaptures:
|
||||
'1': { name: keyword.operator.assignment.ts }
|
||||
end: (?=[,);}\]])|(?=^\s*$)
|
||||
end: (?=[,);}\]])|(?=^\s*$)|(?<=\S)(?<!=)
|
||||
patterns:
|
||||
- include: '#expression'
|
||||
|
||||
|
@ -1504,9 +1504,9 @@ repository:
|
|||
begin: (?:(?<=return|throw|yield|await|default|[=(,:>*?]))\s*(<)(?!<?\=)
|
||||
beginCaptures:
|
||||
'1': { name: meta.brace.angle.ts }
|
||||
end: \>
|
||||
end: (\>)\s*
|
||||
endCaptures:
|
||||
'0': { name: meta.brace.angle.ts }
|
||||
'1': { name: meta.brace.angle.ts }
|
||||
patterns:
|
||||
- include: '#type'
|
||||
- name: cast.expr.ts
|
||||
|
@ -1517,9 +1517,9 @@ repository:
|
|||
begin: (?:(?<=^))\s*(<)(?=[_$[:alpha:]][_$[:alnum:]]*\s*>)
|
||||
beginCaptures:
|
||||
'1': { name: meta.brace.angle.ts }
|
||||
end: \>
|
||||
end: (\>)\s*
|
||||
endCaptures:
|
||||
'0': { name: meta.brace.angle.ts }
|
||||
'1': { name: meta.brace.angle.ts }
|
||||
patterns:
|
||||
- include: '#type'
|
||||
|
||||
|
|
|
@ -3262,7 +3262,7 @@
|
|||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>(?=[,);}\]])|(?=^\s*$)</string>
|
||||
<string>(?=[,);}\]])|(?=^\s*$)|(?<=\S)(?<!=)</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
@ -4131,10 +4131,10 @@
|
|||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>\></string>
|
||||
<string>(\>)\s*</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.brace.angle.ts</string>
|
||||
|
@ -4162,10 +4162,10 @@
|
|||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>\></string>
|
||||
<string>(\>)\s*</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.brace.angle.ts</string>
|
||||
|
|
|
@ -3266,7 +3266,7 @@
|
|||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>(?=[,);}\]])|(?=^\s*$)</string>
|
||||
<string>(?=[,);}\]])|(?=^\s*$)|(?<=\S)(?<!=)</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
|
|
@ -368,7 +368,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.function.ts meta.block.ts meta.block.ts meta.var.expr.ts cast.expr.ts meta.brace.angle.ts
|
||||
^
|
||||
source.ts meta.function.ts meta.block.ts meta.block.ts meta.var.expr.ts
|
||||
source.ts meta.function.ts meta.block.ts meta.block.ts meta.var.expr.ts cast.expr.ts
|
||||
^
|
||||
source.ts meta.function.ts meta.block.ts meta.block.ts meta.var.expr.ts variable.other.readwrite.ts
|
||||
> return f("hello world")
|
||||
|
|
|
@ -108,7 +108,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.var.expr.ts cast.expr.ts meta.brace.angle.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts
|
||||
source.ts meta.var.expr.ts cast.expr.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts punctuation.definition.block.ts
|
||||
^
|
||||
|
@ -153,7 +153,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.var.expr.ts cast.expr.ts meta.brace.angle.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts
|
||||
source.ts meta.var.expr.ts cast.expr.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts punctuation.definition.block.ts
|
||||
^^
|
||||
|
@ -205,7 +205,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.var.expr.ts cast.expr.ts meta.brace.angle.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts
|
||||
source.ts meta.var.expr.ts cast.expr.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts punctuation.definition.block.ts
|
||||
^^
|
||||
|
@ -273,7 +273,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.var.expr.ts cast.expr.ts meta.brace.angle.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts
|
||||
source.ts meta.var.expr.ts cast.expr.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.array.literal.ts meta.brace.square.ts
|
||||
^^
|
||||
|
@ -431,7 +431,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.var.expr.ts cast.expr.ts meta.brace.angle.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts
|
||||
source.ts meta.var.expr.ts cast.expr.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts punctuation.definition.block.ts
|
||||
^
|
||||
|
@ -496,7 +496,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.var.expr.ts cast.expr.ts meta.brace.angle.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts
|
||||
source.ts meta.var.expr.ts cast.expr.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts meta.objectliteral.ts punctuation.definition.block.ts
|
||||
^
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
original file
|
||||
-----------------------------------
|
||||
const x =
|
||||
1
|
||||
if (x) return x
|
||||
-----------------------------------
|
||||
|
||||
Grammar: TypeScript.tmLanguage
|
||||
-----------------------------------
|
||||
>const 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
|
||||
> 1
|
||||
^^^^
|
||||
source.ts meta.var.expr.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts constant.numeric.decimal.ts
|
||||
^
|
||||
source.ts meta.var.expr.ts
|
||||
>if (x) return x
|
||||
^^
|
||||
source.ts keyword.control.conditional.ts
|
||||
^
|
||||
source.ts
|
||||
^
|
||||
source.ts meta.brace.round.ts
|
||||
^
|
||||
source.ts variable.other.readwrite.ts
|
||||
^
|
||||
source.ts meta.brace.round.ts
|
||||
^
|
||||
source.ts
|
||||
^^^^^^
|
||||
source.ts keyword.control.flow.ts
|
||||
^
|
||||
source.ts
|
||||
^
|
||||
source.ts variable.other.readwrite.ts
|
|
@ -29,7 +29,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts meta.export.default.ts cast.expr.ts meta.brace.angle.ts
|
||||
^
|
||||
source.ts meta.export.default.ts
|
||||
source.ts meta.export.default.ts cast.expr.ts
|
||||
^
|
||||
source.ts meta.export.default.ts meta.objectliteral.ts punctuation.definition.block.ts
|
||||
^^
|
||||
|
|
|
@ -69,7 +69,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts cast.expr.ts meta.brace.angle.ts
|
||||
^
|
||||
source.ts
|
||||
source.ts cast.expr.ts
|
||||
^^^^
|
||||
source.ts constant.language.null.ts
|
||||
^^
|
||||
|
@ -169,7 +169,7 @@ Grammar: TypeScript.tmLanguage
|
|||
^
|
||||
source.ts cast.expr.ts meta.brace.angle.ts
|
||||
^
|
||||
source.ts
|
||||
source.ts cast.expr.ts
|
||||
^^^^
|
||||
source.ts constant.language.null.ts
|
||||
^^
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
const x =
|
||||
1
|
||||
if (x) return x
|
Загрузка…
Ссылка в новой задаче