Fixes shorthand property assignment followed by comment

Fixes #666
This commit is contained in:
Sheetal Nandi 2018-09-17 19:27:21 -07:00
Родитель c3f52598cd
Коммит f9a48b762c
5 изменённых файлов: 53 добавлений и 8 удалений

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

@ -1299,12 +1299,12 @@ repository:
patterns:
- include: '#expression'
- name: meta.object.member.ts
match: ({{identifier}})\s*(?=,|\}|$)
match: ({{identifier}})\s*(?=,|\}|$|\/\/|\/\*)
captures:
'1': { name: variable.other.readwrite.ts }
- name: meta.object.member.ts
begin: (?={{identifier}}\s*=)
end: (?=,|\}|$)
end: (?=,|\}|$|\/\/|\/\*)
patterns:
- include: '#expression'
# object member body:

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

@ -4210,7 +4210,7 @@
<key>name</key>
<string>meta.object.member.ts</string>
<key>match</key>
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(?=,|\}|$)</string>
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(?=,|\}|$|\/\/|\/\*)</string>
<key>captures</key>
<dict>
<key>1</key>
@ -4226,7 +4226,7 @@
<key>begin</key>
<string>(?=[_$[:alpha:]][_$[:alnum:]]*\s*=)</string>
<key>end</key>
<string>(?=,|\}|$)</string>
<string>(?=,|\}|$|\/\/|\/\*)</string>
<key>patterns</key>
<array>
<dict>

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

@ -4214,7 +4214,7 @@
<key>name</key>
<string>meta.object.member.tsx</string>
<key>match</key>
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(?=,|\}|$)</string>
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(?=,|\}|$|\/\/|\/\*)</string>
<key>captures</key>
<dict>
<key>1</key>
@ -4230,7 +4230,7 @@
<key>begin</key>
<string>(?=[_$[:alpha:]][_$[:alnum:]]*\s*=)</string>
<key>end</key>
<string>(?=,|\}|$)</string>
<string>(?=,|\}|$|\/\/|\/\*)</string>
<key>patterns</key>
<array>
<dict>

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

@ -3,6 +3,9 @@ original file
switch (0) // discard and renew state per mode
{
}
this.foo({
one, two, three // some comment
})
-----------------------------------
Grammar: TypeScript.tmLanguage
@ -29,4 +32,43 @@ Grammar: TypeScript.tmLanguage
source.ts switch-statement.expr.ts switch-block.expr.ts punctuation.definition.block.ts
>}
^
source.ts switch-statement.expr.ts punctuation.definition.block.ts
source.ts switch-statement.expr.ts punctuation.definition.block.ts
>this.foo({
^^^^
source.ts meta.function-call.ts variable.language.this.ts
^
source.ts meta.function-call.ts punctuation.accessor.ts
^^^
source.ts meta.function-call.ts entity.name.function.ts
^
source.ts meta.brace.round.ts
^
source.ts meta.objectliteral.ts punctuation.definition.block.ts
> one, two, three // some comment
^^^
source.ts meta.objectliteral.ts
^^^
source.ts meta.objectliteral.ts meta.object.member.ts variable.other.readwrite.ts
^
source.ts meta.objectliteral.ts punctuation.separator.comma.ts
^
source.ts meta.objectliteral.ts
^^^
source.ts meta.objectliteral.ts meta.object.member.ts variable.other.readwrite.ts
^
source.ts meta.objectliteral.ts punctuation.separator.comma.ts
^
source.ts meta.objectliteral.ts
^^^^^
source.ts meta.objectliteral.ts meta.object.member.ts variable.other.readwrite.ts
^
source.ts meta.objectliteral.ts meta.object.member.ts
^^
source.ts meta.objectliteral.ts comment.line.double-slash.ts punctuation.definition.comment.ts
^^^^^^^^^^^^^
source.ts meta.objectliteral.ts comment.line.double-slash.ts
>})
^
source.ts meta.objectliteral.ts punctuation.definition.block.ts
^
source.ts meta.brace.round.ts

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

@ -1,3 +1,6 @@
switch (0) // discard and renew state per mode
{
}
}
this.foo({
one, two, three // some comment
})