Support < followed by new line as possibly arrow start

Fixes #637
This commit is contained in:
Sheetal Nandi 2018-07-20 12:52:00 -07:00
Родитель 95bce1d124
Коммит 27425437b2
6 изменённых файлов: 355 добавлений и 31 удалений

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

@ -81,7 +81,8 @@ variables:
(\s*:{{returnTypeOfArrow}})? # return type
\s*=> # arrow operator
)
possiblyMultilineArrow: ({{typeParameters}}?[\(]\s*([\{\[]\s*)?$) # during lookup treat <typeparameters>?( followed by line end as arrow
possiblyMultilineArrowExpressionBeforeEndOfLine: ((({{typeParameters}})?\()|(<))
possiblyMultilineArrow: ((<\s*$)|({{typeParameters}}?[\(]\s*([\{\[]\s*)?$)) # during lookup treat <typeparameters>?( followed by line end as arrow or < followed by new line
functionOrArrowLookup: |-
\s*(
((async\s+)?(
@ -1264,7 +1265,7 @@ repository:
end: (?<=\))
patterns:
- include: '#paren-expression-possibly-arrow-with-typeparameters'
- begin: '{{lookBehindOfPossiblyMultilineArrow}}\s*(async)?(?=\s*({{typeParameters}})?\(\s*$)'
- begin: '{{lookBehindOfPossiblyMultilineArrow}}\s*(async)?(?=\s*{{possiblyMultilineArrowExpressionBeforeEndOfLine}}\s*$)'
beginCaptures:
'1': { name: storage.modifier.async.ts }
end: (?<=\))
@ -1309,7 +1310,7 @@ repository:
# If '<' is preceeded by 'return', 'throw', 'yield', or 'await', it's most likely a type assertion
# If '=', '(', ',', ':', or '>' are followed by a '<', it is also likely a type assertion as otherwise it would be a syntax error
# '<=' and '<<=' are cannot be type assertions, as they are assignment operators.
begin: (?:(?<!\+\+|--)(?<={{lookBehindReturn}}|{{lookBehindThrow}}|{{lookBehindYield}}|{{lookBehindAwait}}|{{lookBehindDefault}}|[=(,:>*?\&\|\^]|[^_$[:alnum:]](?:\+\+|\-\-)|[^\+]\+|[^\-]\-))\s*(<)(?!<?\=)
begin: (?:(?<!\+\+|--)(?<={{lookBehindReturn}}|{{lookBehindThrow}}|{{lookBehindYield}}|{{lookBehindAwait}}|{{lookBehindDefault}}|[=(,:>*?\&\|\^]|[^_$[:alnum:]](?:\+\+|\-\-)|[^\+]\+|[^\-]\-))\s*(<)(?!<?\=)(?!\s*$)
beginCaptures:
'1': { name: meta.brace.angle.ts }
end: (\>)\s*

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

@ -498,7 +498,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -532,7 +532,7 @@
))
))
)) |
(:\s*((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$)) |
(:\s*((&lt;\s*$)|((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$))) |
(:\s*(=&gt;|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(&lt;[^&lt;&gt;]*&gt;)|[^&lt;&gt;(),=])+=\s*(
((async\s+)?(
(function\s*[(&lt;*]) |
@ -540,7 +540,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -944,7 +944,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -978,7 +978,7 @@
))
))
)) |
(:\s*((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$)) |
(:\s*((&lt;\s*$)|((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$))) |
(:\s*(=&gt;|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(&lt;[^&lt;&gt;]*&gt;)|[^&lt;&gt;(),=])+=\s*(
((async\s+)?(
(function\s*[(&lt;*]) |
@ -986,7 +986,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -1413,7 +1413,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -1447,7 +1447,7 @@
))
))
)) |
(:\s*((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$)) |
(:\s*((&lt;\s*$)|((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$))) |
(:\s*(=&gt;|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(&lt;[^&lt;&gt;]*&gt;)|[^&lt;&gt;(),=])+=\s*(
((async\s+)?(
(function\s*[(&lt;*]) |
@ -1455,7 +1455,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -3621,7 +3621,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -4014,7 +4014,7 @@
</dict>
<dict>
<key>begin</key>
<string>(?&lt;=[(=,]|=&gt;)\s*(async)?(?=\s*((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*))?\(\s*$)</string>
<string>(?&lt;=[(=,]|=&gt;)\s*(async)?(?=\s*((((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*))?\()|(&lt;))\s*$)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -4138,7 +4138,7 @@
<key>name</key>
<string>cast.expr.ts</string>
<key>begin</key>
<string>(?:(?&lt;!\+\+|--)(?&lt;=^return|[^\._$[:alnum:]]return|^throw|[^\._$[:alnum:]]throw|^yield|[^\._$[:alnum:]]yield|^await|[^\._$[:alnum:]]await|^default|[^\._$[:alnum:]]default|[=(,:&gt;*?\&amp;\|\^]|[^_$[:alnum:]](?:\+\+|\-\-)|[^\+]\+|[^\-]\-))\s*(&lt;)(?!&lt;?\=)</string>
<string>(?:(?&lt;!\+\+|--)(?&lt;=^return|[^\._$[:alnum:]]return|^throw|[^\._$[:alnum:]]throw|^yield|[^\._$[:alnum:]]yield|^await|[^\._$[:alnum:]]await|^default|[^\._$[:alnum:]]default|[=(,:&gt;*?\&amp;\|\^]|[^_$[:alnum:]](?:\+\+|\-\-)|[^\+]\+|[^\-]\-))\s*(&lt;)(?!&lt;?\=)(?!\s*$)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -5186,7 +5186,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -5935,7 +5935,7 @@
))
))
)) |
(:\s*((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$)))</string>
(:\s*((&lt;\s*$)|((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?[\(]\s*([\{\[]\s*)?$))))</string>
<key>captures</key>
<dict>
<key>1</key>

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

@ -9,7 +9,8 @@ fileTypes: [tsx]
uuid: 805375ec-d614-41f5-8993-5843fe63ea82
variables:
possiblyMultilineArrow: ([\(]\s*([\{\[]\s*)?$) # during lookup treat ( followed by line end as arrow
#possiblyMultilineArrowExpressionBeforeEndOfLine: ({{typeParameters}})?\(
possiblyMultilineArrow: ((<\s*$)|([\(]\s*([\{\[]\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}}*))(?<!\.|-))

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

@ -502,7 +502,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
([\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|([\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -536,7 +536,7 @@
))
))
)) |
(:\s*([\(]\s*([\{\[]\s*)?$)) |
(:\s*((&lt;\s*$)|([\(]\s*([\{\[]\s*)?$))) |
(:\s*(=&gt;|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(&lt;[^&lt;&gt;]*&gt;)|[^&lt;&gt;(),=])+=\s*(
((async\s+)?(
(function\s*[(&lt;*]) |
@ -544,7 +544,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
([\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|([\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -948,7 +948,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
([\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|([\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -982,7 +982,7 @@
))
))
)) |
(:\s*([\(]\s*([\{\[]\s*)?$)) |
(:\s*((&lt;\s*$)|([\(]\s*([\{\[]\s*)?$))) |
(:\s*(=&gt;|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(&lt;[^&lt;&gt;]*&gt;)|[^&lt;&gt;(),=])+=\s*(
((async\s+)?(
(function\s*[(&lt;*]) |
@ -990,7 +990,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
([\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|([\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -1417,7 +1417,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
([\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|([\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -1451,7 +1451,7 @@
))
))
)) |
(:\s*([\(]\s*([\{\[]\s*)?$)) |
(:\s*((&lt;\s*$)|([\(]\s*([\{\[]\s*)?$))) |
(:\s*(=&gt;|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(&lt;[^&lt;&gt;]*&gt;)|[^&lt;&gt;(),=])+=\s*(
((async\s+)?(
(function\s*[(&lt;*]) |
@ -1459,7 +1459,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
([\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|([\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -3625,7 +3625,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
([\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|([\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -4018,7 +4018,7 @@
</dict>
<dict>
<key>begin</key>
<string>(?&lt;=[(=,]|=&gt;)\s*(async)?(?=\s*((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*))?\(\s*$)</string>
<string>(?&lt;=[(=,]|=&gt;)\s*(async)?(?=\s*((((&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*))?\()|(&lt;))\s*$)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
@ -5132,7 +5132,7 @@
([_$[:alpha:]][_$[:alnum:]]*\s*=&gt;)
)) |
((async\s*)?(
([\(]\s*([\{\[]\s*)?$) |
((&lt;\s*$)|([\(]\s*([\{\[]\s*)?$)) |
# sure shot arrow functions even if =&gt; is on new line
(
(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?
@ -5881,7 +5881,7 @@
))
))
)) |
(:\s*([\(]\s*([\{\[]\s*)?$)))</string>
(:\s*((&lt;\s*$)|([\(]\s*([\{\[]\s*)?$))))</string>
<key>captures</key>
<dict>
<key>1</key>

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

@ -0,0 +1,296 @@
original file
-----------------------------------
interface I {}
const goodHighlighting = <T extends I>(
arg: T
) => {
const a = arg
return a
}
const goodHighlighting2 = <
T
>(
arg: T
) => {
const a = arg
return a
}
const badHighlighting = <
T extends I,
>(
arg: T
) => {
const a = arg
return a
}
-----------------------------------
Grammar: TypeScript.tmLanguage
-----------------------------------
>interface I {}
^^^^^^^^^
source.ts meta.interface.ts storage.type.interface.ts
^
source.ts meta.interface.ts
^
source.ts meta.interface.ts entity.name.type.interface.ts
^
source.ts meta.interface.ts
^
source.ts meta.interface.ts punctuation.definition.block.ts
^
source.ts meta.interface.ts punctuation.definition.block.ts
>
^
source.ts
>const goodHighlighting = <T extends I>(
^^^^^
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 entity.name.function.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 meta.arrow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.type.parameters.ts entity.name.type.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.type.parameters.ts
^^^^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.type.parameters.ts storage.modifier.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.type.parameters.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.type.parameters.ts entity.name.type.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
> arg: T
^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameters.ts
^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameters.ts variable.parameter.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameters.ts meta.type.annotation.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameters.ts meta.type.annotation.ts entity.name.type.ts
>) => {
^
source.ts meta.var.expr.ts meta.arrow.ts meta.parameters.ts punctuation.definition.parameters.end.ts
^
source.ts meta.var.expr.ts meta.arrow.ts
^^
source.ts meta.var.expr.ts meta.arrow.ts storage.type.function.arrow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts
> const a = arg
^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts
^^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts storage.type.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.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.arrow.ts meta.block.ts meta.var.expr.ts meta.var-single-variable.expr.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts keyword.operator.assignment.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts
^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts variable.other.readwrite.ts
> return a
^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts
^^^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts keyword.control.flow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts variable.other.readwrite.ts
>}
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts
>
^
source.ts
>const goodHighlighting2 = <
^^^^^
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 entity.name.function.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
^
source.ts meta.var.expr.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
> T
^^
source.ts meta.var.expr.ts meta.type.parameters.ts
^
source.ts meta.var.expr.ts meta.type.parameters.ts entity.name.type.ts
>>(
^
source.ts meta.var.expr.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
^
source.ts meta.var.expr.ts meta.brace.round.ts
> arg: T
^^
source.ts meta.var.expr.ts
^^^
source.ts meta.var.expr.ts variable.parameter.ts
^
source.ts meta.var.expr.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.var.expr.ts meta.type.annotation.ts
^
source.ts meta.var.expr.ts meta.type.annotation.ts entity.name.type.ts
>) => {
^
source.ts meta.var.expr.ts meta.brace.round.ts
^
source.ts meta.var.expr.ts
^^
source.ts meta.var.expr.ts meta.arrow.ts storage.type.function.arrow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts
> const a = arg
^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts
^^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts storage.type.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.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.arrow.ts meta.block.ts meta.var.expr.ts meta.var-single-variable.expr.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts keyword.operator.assignment.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts
^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts variable.other.readwrite.ts
> return a
^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts
^^^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts keyword.control.flow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts variable.other.readwrite.ts
>}
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts
>
^
source.ts
>const badHighlighting = <
^^^^^
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 entity.name.function.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
^
source.ts meta.var.expr.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts
> T extends I,
^^
source.ts meta.var.expr.ts meta.type.parameters.ts
^
source.ts meta.var.expr.ts meta.type.parameters.ts entity.name.type.ts
^
source.ts meta.var.expr.ts meta.type.parameters.ts
^^^^^^^
source.ts meta.var.expr.ts meta.type.parameters.ts storage.modifier.ts
^
source.ts meta.var.expr.ts meta.type.parameters.ts
^
source.ts meta.var.expr.ts meta.type.parameters.ts entity.name.type.ts
^
source.ts meta.var.expr.ts meta.type.parameters.ts punctuation.separator.comma.ts
>>(
^
source.ts meta.var.expr.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts
^
source.ts meta.var.expr.ts meta.brace.round.ts
> arg: T
^^
source.ts meta.var.expr.ts
^^^
source.ts meta.var.expr.ts variable.parameter.ts
^
source.ts meta.var.expr.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.var.expr.ts meta.type.annotation.ts
^
source.ts meta.var.expr.ts meta.type.annotation.ts entity.name.type.ts
>) => {
^
source.ts meta.var.expr.ts meta.brace.round.ts
^
source.ts meta.var.expr.ts
^^
source.ts meta.var.expr.ts meta.arrow.ts storage.type.function.arrow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts
> const a = arg
^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts
^^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts storage.type.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.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.arrow.ts meta.block.ts meta.var.expr.ts meta.var-single-variable.expr.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts keyword.operator.assignment.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts
^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts meta.var.expr.ts variable.other.readwrite.ts
> return a
^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts
^^^^^^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts keyword.control.flow.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts variable.other.readwrite.ts
>}
^
source.ts meta.var.expr.ts meta.arrow.ts meta.block.ts punctuation.definition.block.ts

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

@ -0,0 +1,26 @@
interface I {}
const goodHighlighting = <T extends I>(
arg: T
) => {
const a = arg
return a
}
const goodHighlighting2 = <
T
>(
arg: T
) => {
const a = arg
return a
}
const badHighlighting = <
T extends I,
>(
arg: T
) => {
const a = arg
return a
}