Add numberic literal and regex in binding element matching as it might be needed when matching arrow expression spaned on multiple lines

Fixes #711
This commit is contained in:
Sheetal Nandi 2019-01-22 10:26:11 -08:00
Родитель b80870c2c1
Коммит 444971648e
6 изменённых файлов: 127 добавлений и 1 удалений

Просмотреть файл

@ -429,6 +429,8 @@ repository:
patterns:
- include: '#comment'
- include: '#string'
- include: '#numeric-literal'
- include: '#regex'
- include: '#object-binding-pattern'
- include: '#array-binding-pattern'
- include: '#destructuring-variable-rest'
@ -438,6 +440,8 @@ repository:
patterns:
- include: '#comment'
- include: '#string'
- include: '#numeric-literal'
- include: '#regex'
- include: '#object-binding-pattern-const'
- include: '#array-binding-pattern-const'
- include: '#destructuring-variable-rest-const'
@ -566,6 +570,8 @@ repository:
patterns:
- include: '#comment'
- include: '#string'
- include: '#numeric-literal'
- include: '#regex'
- include: '#parameter-object-binding-pattern'
- include: '#parameter-array-binding-pattern'
- include: '#destructuring-parameter-rest'

Просмотреть файл

@ -1172,6 +1172,14 @@
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#numeric-literal</string>
</dict>
<dict>
<key>include</key>
<string>#regex</string>
</dict>
<dict>
<key>include</key>
<string>#object-binding-pattern</string>
@ -1202,6 +1210,14 @@
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#numeric-literal</string>
</dict>
<dict>
<key>include</key>
<string>#regex</string>
</dict>
<dict>
<key>include</key>
<string>#object-binding-pattern-const</string>
@ -1704,6 +1720,14 @@
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#numeric-literal</string>
</dict>
<dict>
<key>include</key>
<string>#regex</string>
</dict>
<dict>
<key>include</key>
<string>#parameter-object-binding-pattern</string>

Просмотреть файл

@ -1176,6 +1176,14 @@
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#numeric-literal</string>
</dict>
<dict>
<key>include</key>
<string>#regex</string>
</dict>
<dict>
<key>include</key>
<string>#object-binding-pattern</string>
@ -1206,6 +1214,14 @@
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#numeric-literal</string>
</dict>
<dict>
<key>include</key>
<string>#regex</string>
</dict>
<dict>
<key>include</key>
<string>#object-binding-pattern-const</string>
@ -1708,6 +1724,14 @@
<key>include</key>
<string>#string</string>
</dict>
<dict>
<key>include</key>
<string>#numeric-literal</string>
</dict>
<dict>
<key>include</key>
<string>#regex</string>
</dict>
<dict>
<key>include</key>
<string>#parameter-object-binding-pattern</string>

Просмотреть файл

@ -60,8 +60,10 @@ Grammar: TypeScript.tmLanguage
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts variable.object.property.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.destructuring.ts
^^
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts constant.numeric.decimal.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.separator.comma.ts
> foo: 'foo',

Просмотреть файл

@ -0,0 +1,66 @@
original file
-----------------------------------
a => (
{
a: /^mods\//, b: 2
});
-----------------------------------
Grammar: TypeScript.tmLanguage
-----------------------------------
>a => (
^
source.ts meta.arrow.ts variable.parameter.ts
^
source.ts meta.arrow.ts
^^
source.ts meta.arrow.ts storage.type.function.arrow.ts
^
source.ts meta.arrow.ts
^
source.ts meta.arrow.ts meta.brace.round.ts
> {
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.definition.binding-pattern.object.ts
> a: /^mods\//, b: 2
^^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts variable.object.property.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.destructuring.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.regexp.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.regexp.ts punctuation.definition.string.begin.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.regexp.ts keyword.control.anchor.regexp
^^^^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.regexp.ts
^^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.regexp.ts constant.character.escape.backslash.regexp
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts string.regexp.ts punctuation.definition.string.end.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.separator.comma.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts variable.object.property.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.destructuring.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts constant.numeric.decimal.ts
> });
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts
^
source.ts meta.arrow.ts meta.parameter.object-binding-pattern.ts punctuation.definition.binding-pattern.object.ts
^
source.ts meta.arrow.ts meta.brace.round.ts
^
source.ts punctuation.terminator.statement.ts

4
tests/cases/Issue711.ts Normal file
Просмотреть файл

@ -0,0 +1,4 @@
a => (
{
a: /^mods\//, b: 2
});