Update the end of arrow expression to be anything but space or =>

Fixes #461
This commit is contained in:
Sheetal Nandi 2017-06-02 10:36:10 -07:00
Родитель 8c967fe755
Коммит 947bc2edaa
5 изменённых файлов: 262 добавлений и 3 удалений

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

@ -1714,7 +1714,7 @@ repository:
begin: =>
beginCaptures:
'0': { name: storage.type.function.arrow.ts }
end: (?<=\})|((?!\{)(?=\S))
end: (?<=\}|\S)(?<!=>)|((?!\{)(?=\S))
patterns:
- include: '#decl-block'
- include: '#expression'

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

@ -4691,7 +4691,7 @@
</dict>
</dict>
<key>end</key>
<string>(?&lt;=\})|((?!\{)(?=\S))</string>
<string>(?&lt;=\}|\S)(?&lt;!=&gt;)|((?!\{)(?=\S))</string>
<key>patterns</key>
<array>
<dict>

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

@ -4637,7 +4637,7 @@
</dict>
</dict>
<key>end</key>
<string>(?&lt;=\})|((?!\{)(?=\S))</string>
<string>(?&lt;=\}|\S)(?&lt;!=&gt;)|((?!\{)(?=\S))</string>
<key>patterns</key>
<array>
<dict>

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

@ -0,0 +1,246 @@
original file
-----------------------------------
// @onlyOwnGrammar - As this has jsx
class Foo {
renderProgress = () =>
<b className={this.props.className}>x</b>
render () {
return (
<div className={this.state.loaded ? '' : styles.containerUnloaded}>
{!this.state.loaded && this.renderProgress()}
</div>
)
}
}
-----------------------------------
Grammar: TypeScriptReact.tmLanguage
-----------------------------------
>// @onlyOwnGrammar - As this has jsx
^^
source.tsx comment.line.double-slash.tsx punctuation.definition.comment.tsx
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
source.tsx comment.line.double-slash.tsx
>class Foo {
^^^^^
source.tsx meta.class.tsx storage.type.class.tsx
^
source.tsx meta.class.tsx
^^^
source.tsx meta.class.tsx entity.name.type.class.tsx
^
source.tsx meta.class.tsx
^
source.tsx meta.class.tsx punctuation.definition.block.tsx
^^
source.tsx meta.class.tsx
> renderProgress = () =>
^^
source.tsx meta.class.tsx
^^^^^^^^^^^^^^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.definition.property.tsx entity.name.function.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx keyword.operator.assignment.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.parameters.tsx punctuation.definition.parameters.begin.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.parameters.tsx punctuation.definition.parameters.end.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx
^^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx storage.type.function.arrow.tsx
^^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx
> <b className={this.props.className}>x</b>
^^^^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx punctuation.definition.tag.begin.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx entity.name.tag.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx
^^^^^^^^^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx entity.other.attribute-name.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx keyword.operator.assignment.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.section.embedded.begin.tsx
^^^^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx meta.embedded.expression.tsx variable.language.this.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx
^^^^^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx meta.embedded.expression.tsx variable.other.object.property.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx
^^^^^^^^^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx meta.embedded.expression.tsx support.variable.property.dom.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.section.embedded.end.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx punctuation.definition.tag.end.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx meta.jsx.children.tsx
^^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx punctuation.definition.tag.begin.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx entity.name.tag.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx meta.arrow.tsx meta.tag.tsx punctuation.definition.tag.end.tsx
^
source.tsx meta.class.tsx meta.field.declaration.tsx
>
^^
source.tsx meta.class.tsx
> render () {
^^
source.tsx meta.class.tsx
^^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.definition.method.tsx entity.name.function.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.parameters.tsx punctuation.definition.parameters.begin.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.parameters.tsx punctuation.definition.parameters.end.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx punctuation.definition.block.tsx
^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx
> return (
^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx
^^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx keyword.control.flow.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.brace.round.tsx
^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx
> <div className={this.state.loaded ? '' : styles.containerUnloaded}>
^^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx punctuation.definition.tag.begin.tsx
^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx entity.name.tag.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx
^^^^^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx entity.other.attribute-name.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx keyword.operator.assignment.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.section.embedded.begin.tsx
^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx variable.language.this.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx
^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx variable.other.object.property.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx
^^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx variable.other.property.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx keyword.operator.ternary.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx string.quoted.single.tsx punctuation.definition.string.begin.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx string.quoted.single.tsx punctuation.definition.string.end.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx keyword.operator.ternary.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx
^^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx variable.other.object.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx
^^^^^^^^^^^^^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx variable.other.property.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.section.embedded.end.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx punctuation.definition.tag.end.tsx
^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx
> {!this.state.loaded && this.renderProgress()}
^^^^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx punctuation.section.embedded.begin.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx keyword.operator.logical.tsx
^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx variable.language.this.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx punctuation.accessor.tsx
^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx variable.other.object.property.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx punctuation.accessor.tsx
^^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx variable.other.property.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx
^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx keyword.operator.logical.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx
^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx meta.function-call.tsx variable.language.this.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx meta.function-call.tsx punctuation.accessor.tsx
^^^^^^^^^^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx meta.function-call.tsx entity.name.function.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx meta.brace.round.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx meta.brace.round.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx meta.embedded.expression.tsx punctuation.section.embedded.end.tsx
^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx
> </div>
^^^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx meta.jsx.children.tsx
^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx punctuation.definition.tag.begin.tsx
^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx entity.name.tag.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.tag.tsx punctuation.definition.tag.end.tsx
^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx
> )
^^^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx meta.brace.round.tsx
^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx
> }
^^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx
^
source.tsx meta.class.tsx meta.method.declaration.tsx meta.block.tsx punctuation.definition.block.tsx
^^
source.tsx meta.class.tsx
>}
^
source.tsx meta.class.tsx punctuation.definition.block.tsx

13
tests/cases/Issue461.tsx Normal file
Просмотреть файл

@ -0,0 +1,13 @@
// @onlyOwnGrammar - As this has jsx
class Foo {
renderProgress = () =>
<b className={this.props.className}>x</b>
render () {
return (
<div className={this.state.loaded ? '' : styles.containerUnloaded}>
{!this.state.loaded && this.renderProgress()}
</div>
)
}
}