Merge branch 'master' into multiLineArrowParameters

This commit is contained in:
Sheetal Nandi 2018-03-13 13:45:03 -07:00
Родитель bf14f62317 874564b73c
Коммит ee94bd5f87
8 изменённых файлов: 267 добавлений и 267 удалений

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

@ -37,9 +37,9 @@ variables:
# Identifier start | matching braces | matching parenthesis | matching square brackets | matching strings
typeArgumentsStart: ({{typeParamersStart}}|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))
typeArgumentsInnerExpressionPart: '[^<>\(]|{{matchingParenthesis}}|(?<==)\>'
typeArguments: (<\s*{{typeArgumentsStart}}({{typeArgumentsInnerExpressionPart}}|\<\s*{{typeArgumentsStart}}({{typeArgumentsInnerExpressionPart}})*(?!=)\>)*(?!=)>\s*)
typeArguments: '<\s*{{typeArgumentsStart}}({{typeArgumentsInnerExpressionPart}}|\<\s*{{typeArgumentsStart}}({{typeArgumentsInnerExpressionPart}})*(?!=)\>)*(?!=)>'
functionCallLookup: \s*(\?\.\s*)?({{typeArguments}}\s*)?\(
returnTypeOfArrow: \s*([^<>\(\)]|\<[^<>]+\>|\([^\(\)]+\))+
functionCallLookup: \s*(\?\.\s*)?{{typeArguments}}?\(
arrowLookup: |-
# sure shot arrow functions even if => is on new line
(
@ -1121,16 +1121,7 @@ repository:
- include: '#comment'
- name: meta.function-call.ts punctuation.accessor.optional.ts
match: \?\.
- name: meta.type.parameters.ts
begin: \<
beginCaptures:
'0': { name: punctuation.definition.typeparameters.begin.ts }
end: \>
endCaptures:
'0': { name: punctuation.definition.typeparameters.end.ts }
patterns:
- include: '#type'
- include: '#punctuation-comma'
- include: '#type-arguments'
- include: '#paren-expression'
new-expr:
@ -1290,7 +1281,7 @@ repository:
- name: keyword.operator.arithmetic.ts
match: '%|\*|/|-|\+'
# capture the arithmetic sign followed by variable or parenthesized expression so that it is not interpreted as regex
- match: (?<=[_$[:alnum:])])\s*(/)(?![/*])
- match: (?<=[_$[:alnum:])\]])\s*(/)(?![/*])
captures:
'1': { name: keyword.operator.arithmetic.ts }
@ -1814,6 +1805,19 @@ repository:
- include: '#type'
- include: '#punctuation-comma'
#type arguments
type-arguments:
name: meta.type.parameters.ts
begin: \<
beginCaptures:
'0': { name: punctuation.definition.typeparameters.begin.ts }
end: \>
endCaptures:
'0': { name: punctuation.definition.typeparameters.end.ts }
patterns:
- include: '#type'
- include: '#punctuation-comma'
#different types
type:
patterns:
@ -2092,7 +2096,7 @@ repository:
- include: '#regexp'
# Check if complete regexp syntax
- name: string.regexp.ts
begin: (?<![_$[:alnum:])])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))
begin: (?<![_$[:alnum:])\]])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))
beginCaptures:
'0': {name: punctuation.definition.string.begin.ts}
end: (/)([gimuy]*)

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

@ -3502,39 +3502,8 @@
<string>\?\.</string>
</dict>
<dict>
<key>name</key>
<string>meta.type.parameters.ts</string>
<key>begin</key>
<string>\&lt;</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.typeparameters.begin.ts</string>
</dict>
</dict>
<key>end</key>
<string>\&gt;</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.typeparameters.end.ts</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#type</string>
</dict>
<dict>
<key>include</key>
<string>#punctuation-comma</string>
</dict>
</array>
<key>include</key>
<string>#type-arguments</string>
</dict>
<dict>
<key>include</key>
@ -4001,7 +3970,7 @@
</dict>
<dict>
<key>match</key>
<string>(?&lt;=[_$[:alnum:])])\s*(/)(?![/*])</string>
<string>(?&lt;=[_$[:alnum:])\]])\s*(/)(?![/*])</string>
<key>captures</key>
<dict>
<key>1</key>
@ -5153,6 +5122,42 @@
</dict>
</array>
</dict>
<key>type-arguments</key>
<dict>
<key>name</key>
<string>meta.type.parameters.ts</string>
<key>begin</key>
<string>\&lt;</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.typeparameters.begin.ts</string>
</dict>
</dict>
<key>end</key>
<string>\&gt;</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.typeparameters.end.ts</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#type</string>
</dict>
<dict>
<key>include</key>
<string>#punctuation-comma</string>
</dict>
</array>
</dict>
<key>type</key>
<dict>
<key>patterns</key>
@ -5906,7 +5911,7 @@
<key>name</key>
<string>string.regexp.ts</string>
<key>begin</key>
<string>(?&lt;![_$[:alnum:])])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))</string>
<string>(?&lt;![_$[:alnum:])\]])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))</string>
<key>beginCaptures</key>
<dict>
<key>0</key>

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

@ -10,6 +10,14 @@ uuid: 805375ec-d614-41f5-8993-5843fe63ea82
variables:
possiblyMultilineArrow: ([\(]\s*$) # during lookup treat ( followed by line end as arrow
jsxTagOrAtrributeIdentifier: '[_$a-zA-Z][-$\w.]'
jsxTagNamespace: (?:({{jsxTagOrAtrributeIdentifier}}*)(?<!\.|-)(:))?
jsxTagName: \s*{{jsxTagNamespace}}((?:[a-z][a-z0-9]*|({{jsxTagOrAtrributeIdentifier}}*))(?<!\.|-))
jsxOpeningTagWithoutAttributes: (<){{jsxTagName}}?\s*(>)
jsxClosingTag: (</){{jsxTagName}}?\s*(>)
jsxTagStart: (<){{jsxTagName}}(?=({{typeArguments}})?\s+(?!\?)|\/?>)
jsxTagStartLookahead: (?={{jsxTagStart}})
jsxLookBehindInExpression: (?<=[({\[,?=>:*]|&&|\|\||\?|{{lookBehindReturn}}|{{lookBehindDefault}}|^)\s*
repository:
# Additions:
@ -34,18 +42,15 @@ repository:
#jsx tags
jsx-tag-without-attributes-in-expression:
begin: |-
(?x)
(?<=[({\[,?=>:*]|&&|\|\||\?|{{lookBehindReturn}}|{{lookBehindDefault}}|^)\s*
(?=(<)\s*(?:([_$a-zA-Z][-$\w.]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?<!\.|-))?\s*(>))
end: (?!\s*(<)\s*(?:([_$a-zA-Z][-$\w.]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?<!\.|-))?\s*(>))
begin: '{{jsxLookBehindInExpression}}(?={{jsxOpeningTagWithoutAttributes}})'
end: (?!{{jsxOpeningTagWithoutAttributes}})
patterns:
- include: '#jsx-tag-without-attributes'
jsx-tag-without-attributes:
name: meta.tag.without-attributes.tsx
begin: (<)\s*(?:([_$a-zA-Z][-$\w.]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?<!\.|-))?\s*(>)
end: (</)\s*(?:([_$a-zA-Z][-$\w.]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?<!\.|-))?\s*(>)
begin: '{{jsxOpeningTagWithoutAttributes}}'
end: '{{jsxClosingTag}}'
beginCaptures:
'1': {name: punctuation.definition.tag.begin.tsx}
'2': {name: entity.name.tag.namespace.tsx}
@ -68,36 +73,18 @@ repository:
# We need to differentiate between the relational '<' operator and the beginning of a tag using the surrounding context.
begin: |-
(?x)
(?<=[({\[,?=>:*]|&&|\|\||\?|{{lookBehindReturn}}|{{lookBehindDefault}}|^)\s*
{{jsxLookBehindInExpression}}
(?!<\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s+[^=>])|,)) # look ahead is not type parameter of arrow
(?=(<)\s*
([_$a-zA-Z][-$\w.]*(?<!\.|-):)?
([_$a-zA-Z][-$\w.]*(?<!\.|-))
(?=\s+(?!\?)|/?>))
end: (/>)|(?:(</)\s*(?:([_$a-zA-Z][-$\w.]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?<!\.|-))\s*(>))
endCaptures:
'0': { name: meta.tag.tsx }
'1': { name: punctuation.definition.tag.end.tsx }
'2': { name: punctuation.definition.tag.begin.tsx }
'3': { name: entity.name.tag.namespace.tsx }
'4': { name: punctuation.separator.namespace.tsx }
'5': { name: entity.name.tag.tsx }
'6': { name: support.class.component.tsx }
'7': { name: punctuation.definition.tag.end.tsx }
{{jsxTagStartLookahead}}
end: (?!{{jsxTagStart}})
patterns:
- include: '#jsx-tag'
jsx-child-tag:
# Because this would be included from the jsx-children, this doesnt need to inspect surrounding context
begin: |-
(?x)
(?=(<)\s*
([_$a-zA-Z][-$\w.]*(?<!\.|-):)?
([_$a-zA-Z][-$\w.]*(?<!\.|-))
(?=\s+(?!\?)|/?>))
end: (/>)|(?:(</)\s*(?:([_$a-zA-Z][-$\w.]*)(?<!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?<!\.|-))\s*(>))
jsx-tag:
name: meta.tag.tsx
begin: '{{jsxTagStartLookahead}}'
end: (/>)|(?:{{jsxClosingTag}})
endCaptures:
'0': { name: meta.tag.tsx }
'1': { name: punctuation.definition.tag.end.tsx }
'2': { name: punctuation.definition.tag.begin.tsx }
'3': { name: entity.name.tag.namespace.tsx }
@ -106,24 +93,7 @@ repository:
'6': { name: support.class.component.tsx }
'7': { name: punctuation.definition.tag.end.tsx }
patterns:
- include: '#jsx-tag'
jsx-tag:
name: meta.tag.tsx
begin: |-
(?x)
(?=(<)\s*
(?:([_$a-zA-Z][-$\w.]*)(?<!\.|-)(:))?
([_$a-zA-Z][-$\w.]*(?<!\.|-))
(?=\s+(?!\?)|/?>))
end: (?=(/>)|(?:(</)\s*(?:([_$a-zA-Z][-$\w.]*)(?<!\.|-)(:))?([_$a-zA-Z][-$\w.]*(?<!\.|-))\s*(>)))
patterns:
- begin: |-
(?x)
(<)\s*
(?:([_$a-zA-Z][-$\w.]*)(?<!\.|-)(:))?
((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?<!\.|-))
(?=\s+(?!\?)|/?>)
- begin: '{{jsxTagStart}}'
beginCaptures:
'1': { name: punctuation.definition.tag.begin.tsx }
'2': { name: entity.name.tag.namespace.tsx }
@ -131,11 +101,10 @@ repository:
'4': { name: entity.name.tag.tsx }
'5': { name: support.class.component.tsx }
end: (?=[/]?>)
contentName: meta.tag.attributes.tsx
patterns:
- include: '#comment'
- include: '#type-arguments'
- include: '#jsx-tag-attributes'
- include: '#jsx-tag-attributes-illegal'
- begin: (>)
beginCaptures:
'1': { name: punctuation.definition.tag.end.tsx }
@ -148,7 +117,8 @@ repository:
jsx-children:
patterns:
- include: '#jsx-tag-without-attributes'
- include: '#jsx-child-tag'
# Because this would be included from the jsx-children, this doesnt need to inspect surrounding context
- include: '#jsx-tag'
- include: '#jsx-evaluated-code'
- include: '#jsx-entities'
@ -176,18 +146,22 @@ repository:
#jsx attributes
jsx-tag-attributes:
name: meta.tag.attributes.tsx
begin: \s+
end: (?=[/]?>)
patterns:
- include: '#jsx-tag-attribute-name'
- include: '#jsx-tag-attribute-assignment'
- include: '#jsx-string-double-quoted'
- include: '#jsx-string-single-quoted'
- include: '#jsx-evaluated-code'
- include: '#jsx-tag-attributes-illegal'
jsx-tag-attribute-name:
match: |-
(?x)
\s*
(?:([_$a-zA-Z][-$\w.]*)(:))?
(?:({{jsxTagOrAtrributeIdentifier}}*)(:))?
([_$a-zA-Z][-$\w]*)
(?=\s|=|/?>|/\*|//)
captures:

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

@ -3506,39 +3506,8 @@
<string>\?\.</string>
</dict>
<dict>
<key>name</key>
<string>meta.type.parameters.tsx</string>
<key>begin</key>
<string>\&lt;</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.typeparameters.begin.tsx</string>
</dict>
</dict>
<key>end</key>
<string>\&gt;</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.typeparameters.end.tsx</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#type</string>
</dict>
<dict>
<key>include</key>
<string>#punctuation-comma</string>
</dict>
</array>
<key>include</key>
<string>#type-arguments</string>
</dict>
<dict>
<key>include</key>
@ -3947,7 +3916,7 @@
</dict>
<dict>
<key>match</key>
<string>(?&lt;=[_$[:alnum:])])\s*(/)(?![/*])</string>
<string>(?&lt;=[_$[:alnum:])\]])\s*(/)(?![/*])</string>
<key>captures</key>
<dict>
<key>1</key>
@ -5099,6 +5068,42 @@
</dict>
</array>
</dict>
<key>type-arguments</key>
<dict>
<key>name</key>
<string>meta.type.parameters.tsx</string>
<key>begin</key>
<string>\&lt;</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.typeparameters.begin.tsx</string>
</dict>
</dict>
<key>end</key>
<string>\&gt;</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.typeparameters.end.tsx</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#type</string>
</dict>
<dict>
<key>include</key>
<string>#punctuation-comma</string>
</dict>
</array>
</dict>
<key>type</key>
<dict>
<key>patterns</key>
@ -5852,7 +5857,7 @@
<key>name</key>
<string>string.regexp.tsx</string>
<key>begin</key>
<string>(?&lt;![_$[:alnum:])])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))</string>
<string>(?&lt;![_$[:alnum:])\]])\/(?![\/*])(?=(?:[^\/\\\[]|\\.|\[([^\]\\]|\\.)+\])+\/(?![\/*])[gimuy]*(?!\s*[a-zA-Z0-9_$]))</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
@ -7089,11 +7094,9 @@
<key>jsx-tag-without-attributes-in-expression</key>
<dict>
<key>begin</key>
<string>(?x)
(?&lt;=[({\[,?=&gt;:*]|&amp;&amp;|\|\||\?|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^)\s*
(?=(&lt;)\s*(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?&lt;!\.|-))?\s*(&gt;))</string>
<string>(?&lt;=[({\[,?=&gt;:*]|&amp;&amp;|\|\||\?|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^)\s*(?=(&lt;)\s*(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?&lt;!\.|-))?\s*(&gt;))</string>
<key>end</key>
<string>(?!\s*(&lt;)\s*(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?&lt;!\.|-))?\s*(&gt;))</string>
<string>(?!(&lt;)\s*(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?&lt;!\.|-))?\s*(&gt;))</string>
<key>patterns</key>
<array>
<dict>
@ -7192,116 +7195,9 @@
<string>(?x)
(?&lt;=[({\[,?=&gt;:*]|&amp;&amp;|\|\||\?|^return|[^\._$[:alnum:]]return|^default|[^\._$[:alnum:]]default|^)\s*
(?!&lt;\s*[_$[:alpha:]][_$[:alnum:]]*((\s+extends\s+[^=&gt;])|,)) # look ahead is not type parameter of arrow
(?=(&lt;)\s*
([_$a-zA-Z][-$\w.]*(?&lt;!\.|-):)?
([_$a-zA-Z][-$\w.]*(?&lt;!\.|-))
(?=\s+(?!\?)|/?&gt;))</string>
(?=(&lt;)\s*(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?&lt;!\.|-))(?=(&lt;\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?!=)\&gt;)*(?!=)&gt;)?\s+(?!\?)|\/?&gt;))</string>
<key>end</key>
<string>(/&gt;)|(?:(&lt;/)\s*(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?&lt;!\.|-))\s*(&gt;))</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>meta.tag.tsx</string>
</dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.end.tsx</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.begin.tsx</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.tag.namespace.tsx</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>punctuation.separator.namespace.tsx</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>entity.name.tag.tsx</string>
</dict>
<key>6</key>
<dict>
<key>name</key>
<string>support.class.component.tsx</string>
</dict>
<key>7</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.end.tsx</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#jsx-tag</string>
</dict>
</array>
</dict>
<key>jsx-child-tag</key>
<dict>
<key>begin</key>
<string>(?x)
(?=(&lt;)\s*
([_$a-zA-Z][-$\w.]*(?&lt;!\.|-):)?
([_$a-zA-Z][-$\w.]*(?&lt;!\.|-))
(?=\s+(?!\?)|/?&gt;))</string>
<key>end</key>
<string>(/&gt;)|(?:(&lt;/)\s*(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?&lt;!\.|-))\s*(&gt;))</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>meta.tag.tsx</string>
</dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.end.tsx</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.begin.tsx</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.tag.namespace.tsx</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>punctuation.separator.namespace.tsx</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>entity.name.tag.tsx</string>
</dict>
<key>6</key>
<dict>
<key>name</key>
<string>support.class.component.tsx</string>
</dict>
<key>7</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.end.tsx</string>
</dict>
</dict>
<string>(?!(&lt;)\s*(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?&lt;!\.|-))(?=(&lt;\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?!=)\&gt;)*(?!=)&gt;)?\s+(?!\?)|\/?&gt;))</string>
<key>patterns</key>
<array>
<dict>
@ -7315,22 +7211,52 @@
<key>name</key>
<string>meta.tag.tsx</string>
<key>begin</key>
<string>(?x)
(?=(&lt;)\s*
(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?
([_$a-zA-Z][-$\w.]*(?&lt;!\.|-))
(?=\s+(?!\?)|/?&gt;))</string>
<string>(?=(&lt;)\s*(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?&lt;!\.|-))(?=(&lt;\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?!=)\&gt;)*(?!=)&gt;)?\s+(?!\?)|\/?&gt;))</string>
<key>end</key>
<string>(?=(/&gt;)|(?:(&lt;/)\s*(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?([_$a-zA-Z][-$\w.]*(?&lt;!\.|-))\s*(&gt;)))</string>
<string>(/&gt;)|(?:(&lt;/)\s*(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?&lt;!\.|-))?\s*(&gt;))</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.end.tsx</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.begin.tsx</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.tag.namespace.tsx</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>punctuation.separator.namespace.tsx</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>entity.name.tag.tsx</string>
</dict>
<key>6</key>
<dict>
<key>name</key>
<string>support.class.component.tsx</string>
</dict>
<key>7</key>
<dict>
<key>name</key>
<string>punctuation.definition.tag.end.tsx</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(?x)
(&lt;)\s*
(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?
((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?&lt;!\.|-))
(?=\s+(?!\?)|/?&gt;)</string>
<string>(&lt;)\s*(?:([_$a-zA-Z][-$\w.]*)(?&lt;!\.|-)(:))?((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?&lt;!\.|-))(?=(&lt;\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;|\&lt;\s*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))|(\'[^\']*\')|(\"[^\"]*\")|(\`[^\`]*\`))([^&lt;&gt;\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?&lt;==)\&gt;)*(?!=)\&gt;)*(?!=)&gt;)?\s+(?!\?)|\/?&gt;)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -7361,8 +7287,6 @@
</dict>
<key>end</key>
<string>(?=[/]?&gt;)</string>
<key>contentName</key>
<string>meta.tag.attributes.tsx</string>
<key>patterns</key>
<array>
<dict>
@ -7371,11 +7295,11 @@
</dict>
<dict>
<key>include</key>
<string>#jsx-tag-attributes</string>
<string>#type-arguments</string>
</dict>
<dict>
<key>include</key>
<string>#jsx-tag-attributes-illegal</string>
<string>#jsx-tag-attributes</string>
</dict>
</array>
</dict>
@ -7414,7 +7338,7 @@
</dict>
<dict>
<key>include</key>
<string>#jsx-child-tag</string>
<string>#jsx-tag</string>
</dict>
<dict>
<key>include</key>
@ -7491,6 +7415,12 @@
</dict>
<key>jsx-tag-attributes</key>
<dict>
<key>name</key>
<string>meta.tag.attributes.tsx</string>
<key>begin</key>
<string>\s+</string>
<key>end</key>
<string>(?=[/]?&gt;)</string>
<key>patterns</key>
<array>
<dict>
@ -7513,6 +7443,10 @@
<key>include</key>
<string>#jsx-evaluated-code</string>
</dict>
<dict>
<key>include</key>
<string>#jsx-tag-attributes-illegal</string>
</dict>
</array>
</dict>
<key>jsx-tag-attribute-name</key>

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

@ -0,0 +1,40 @@
original file
-----------------------------------
(a[0] / 2) / (2)
-----------------------------------
Grammar: TypeScript.tmLanguage
-----------------------------------
>(a[0] / 2) / (2)
^
source.ts meta.brace.round.ts
^
source.ts variable.other.readwrite.ts
^
source.ts meta.array.literal.ts meta.brace.square.ts
^
source.ts meta.array.literal.ts constant.numeric.decimal.ts
^
source.ts meta.array.literal.ts meta.brace.square.ts
^
source.ts
^
source.ts keyword.operator.arithmetic.ts
^
source.ts
^
source.ts constant.numeric.decimal.ts
^
source.ts meta.brace.round.ts
^
source.ts
^
source.ts keyword.operator.arithmetic.ts
^
source.ts
^
source.ts meta.brace.round.ts
^
source.ts constant.numeric.decimal.ts
^
source.ts meta.brace.round.ts

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

@ -0,0 +1,40 @@
original file
-----------------------------------
// @onlyOwnGrammar - As this has jsx
<MyComponent<number> data={12} />
-----------------------------------
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
><MyComponent<number> data={12} />
^
source.tsx meta.tag.tsx punctuation.definition.tag.begin.tsx
^^^^^^^^^^^
source.tsx meta.tag.tsx entity.name.tag.tsx support.class.component.tsx
^
source.tsx meta.tag.tsx meta.type.parameters.tsx punctuation.definition.typeparameters.begin.tsx
^^^^^^
source.tsx meta.tag.tsx meta.type.parameters.tsx support.type.primitive.tsx
^
source.tsx meta.tag.tsx meta.type.parameters.tsx punctuation.definition.typeparameters.end.tsx
^
source.tsx meta.tag.tsx meta.tag.attributes.tsx
^^^^
source.tsx meta.tag.tsx meta.tag.attributes.tsx entity.other.attribute-name.tsx
^
source.tsx meta.tag.tsx meta.tag.attributes.tsx keyword.operator.assignment.tsx
^
source.tsx meta.tag.tsx meta.tag.attributes.tsx meta.embedded.expression.tsx punctuation.section.embedded.begin.tsx
^^
source.tsx meta.tag.tsx meta.tag.attributes.tsx meta.embedded.expression.tsx constant.numeric.decimal.tsx
^
source.tsx meta.tag.tsx meta.tag.attributes.tsx meta.embedded.expression.tsx punctuation.section.embedded.end.tsx
^
source.tsx meta.tag.tsx meta.tag.attributes.tsx
^^
source.tsx meta.tag.tsx punctuation.definition.tag.end.tsx

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

@ -0,0 +1 @@
(a[0] / 2) / (2)

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

@ -0,0 +1,2 @@
// @onlyOwnGrammar - As this has jsx
<MyComponent<number> data={12} />