Mercurial > vim
comparison runtime/syntax/typescriptcommon.vim @ 18750:82a28df1e2d5
Update runtime files.
Commit: https://github.com/vim/vim/commit/91359014b359cf816bf943fe2c7d492996263def
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Nov 30 17:57:03 2019 +0100
Update runtime files.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 30 Nov 2019 18:00:05 +0100 |
parents | cb3163d590a1 |
children | 8dad79c661d1 |
comparison
equal
deleted
inserted
replaced
18749:8217e179eb58 | 18750:82a28df1e2d5 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: TypeScript and TypeScriptReact | 2 " Language: TypeScript and TypeScriptReact |
3 " Maintainer: Bram Moolenaar | 3 " Maintainer: Bram Moolenaar, Herrington Darkholme |
4 " Last Change: 2019 Nov 17 | 4 " Last Change: 2019 Nov 30 |
5 " Based On: Herrington Darkholme's yats.vim | 5 " Based On: Herrington Darkholme's yats.vim |
6 " Changes: See https:github.com/HerringtonDarkholme/yats.vim | 6 " Changes: See https:github.com/HerringtonDarkholme/yats.vim |
7 " Credits: See yats.vim on github | 7 " Credits: See yats.vim on github |
8 | 8 |
9 if &cpo =~ 'C' | 9 if &cpo =~ 'C' |
10 let s:cpo_save = &cpo | 10 let s:cpo_save = &cpo |
11 set cpo&vim | 11 set cpo&vim |
12 endif | 12 endif |
13 | 13 |
14 " runtime syntax/common.vim | |
15 | 14 |
16 " NOTE: this results in accurate highlighting, but can be slow. | 15 " NOTE: this results in accurate highlighting, but can be slow. |
17 syntax sync fromstart | 16 syntax sync fromstart |
18 | 17 |
19 "Dollar sign is permitted anywhere in an identifier | 18 "Dollar sign is permitted anywhere in an identifier |
20 setlocal iskeyword-=$ | 19 setlocal iskeyword-=$ |
21 if main_syntax == 'typescript' || main_syntax == 'typescript.tsx' | 20 if main_syntax == 'typescript' || main_syntax == 'typescriptreact' |
22 setlocal iskeyword+=$ | 21 setlocal iskeyword+=$ |
23 " syntax cluster htmlJavaScript contains=TOP | 22 " syntax cluster htmlJavaScript contains=TOP |
24 endif | 23 endif |
25 | 24 |
26 " lowest priority on least used feature | 25 " lowest priority on least used feature |
51 \ nextgroup=@afterIdentifier | 50 \ nextgroup=@afterIdentifier |
52 \ skipwhite skipempty | 51 \ skipwhite skipempty |
53 | 52 |
54 syntax region typescriptIndexExpr contained matchgroup=typescriptProperty start=/\[/rs=s+1 end=/]/he=e-1 contains=@typescriptValue nextgroup=@typescriptSymbols,typescriptDotNotation,typescriptFuncCallArg skipwhite skipempty | 53 syntax region typescriptIndexExpr contained matchgroup=typescriptProperty start=/\[/rs=s+1 end=/]/he=e-1 contains=@typescriptValue nextgroup=@typescriptSymbols,typescriptDotNotation,typescriptFuncCallArg skipwhite skipempty |
55 | 54 |
56 syntax match typescriptDotNotation /\./ nextgroup=typescriptProp skipnl | 55 syntax match typescriptDotNotation /\.\|?\.\|!\./ nextgroup=typescriptProp skipnl |
57 syntax match typescriptDotStyleNotation /\.style\./ nextgroup=typescriptDOMStyle transparent | 56 syntax match typescriptDotStyleNotation /\.style\./ nextgroup=typescriptDOMStyle transparent |
58 " syntax match typescriptFuncCall contained /[a-zA-Z]\k*\ze(/ nextgroup=typescriptFuncCallArg | 57 " syntax match typescriptFuncCall contained /[a-zA-Z]\k*\ze(/ nextgroup=typescriptFuncCallArg |
59 syntax region typescriptParenExp matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptComments,@typescriptValue,typescriptCastKeyword nextgroup=@typescriptSymbols skipwhite skipempty | 58 syntax region typescriptParenExp matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptComments,@typescriptValue,typescriptCastKeyword nextgroup=@typescriptSymbols skipwhite skipempty |
60 syntax region typescriptFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptValue,@typescriptComments nextgroup=@typescriptSymbols,typescriptDotNotation skipwhite skipempty skipnl | 59 syntax region typescriptFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptValue,@typescriptComments nextgroup=@typescriptSymbols,typescriptDotNotation skipwhite skipempty skipnl |
61 syntax region typescriptEventFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptEventExpression | 60 syntax region typescriptEventFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptEventExpression |
141 " + - ^ ~ | 140 " + - ^ ~ |
142 syntax match typescriptUnaryOp /[+\-~!]/ | 141 syntax match typescriptUnaryOp /[+\-~!]/ |
143 \ nextgroup=@typescriptValue | 142 \ nextgroup=@typescriptValue |
144 \ skipwhite | 143 \ skipwhite |
145 | 144 |
146 syntax region typescriptTernary matchgroup=typescriptTernaryOp start=/?/ end=/:/ contained contains=@typescriptValue,@typescriptComments nextgroup=@typescriptValue skipwhite skipempty | 145 syntax region typescriptTernary matchgroup=typescriptTernaryOp start=/?[.?]\@!/ end=/:/ contained contains=@typescriptValue,@typescriptComments nextgroup=@typescriptValue skipwhite skipempty |
147 | 146 |
148 syntax match typescriptAssign /=/ nextgroup=@typescriptValue | 147 syntax match typescriptAssign /=/ nextgroup=@typescriptValue |
149 \ skipwhite skipempty | 148 \ skipwhite skipempty |
150 | 149 |
151 " 2: ==, === | 150 " 2: ==, === |
175 " 2: **, **= | 174 " 2: **, **= |
176 syntax match typescriptBinaryOp contained /\*\*=\?/ nextgroup=@typescriptValue | 175 syntax match typescriptBinaryOp contained /\*\*=\?/ nextgroup=@typescriptValue |
177 | 176 |
178 syntax cluster typescriptSymbols contains=typescriptBinaryOp,typescriptKeywordOp,typescriptTernary,typescriptAssign,typescriptCastKeyword | 177 syntax cluster typescriptSymbols contains=typescriptBinaryOp,typescriptKeywordOp,typescriptTernary,typescriptAssign,typescriptCastKeyword |
179 | 178 |
180 "" runtime syntax/basic/reserved.vim | 179 " runtime syntax/basic/reserved.vim |
181 | 180 |
182 "runtime syntax/basic/keyword.vim | 181 "runtime syntax/basic/keyword.vim |
183 "Import | 182 "Import |
184 syntax keyword typescriptImport from as import | 183 syntax keyword typescriptImport from as import |
185 syntax keyword typescriptExport export | 184 syntax keyword typescriptExport export |
305 syntax match typescriptDocNotation contained /@/ nextgroup=typescriptDocTags | 304 syntax match typescriptDocNotation contained /@/ nextgroup=typescriptDocTags |
306 | 305 |
307 syntax keyword typescriptDocTags contained constant constructor constructs function ignore inner private public readonly static | 306 syntax keyword typescriptDocTags contained constant constructor constructs function ignore inner private public readonly static |
308 syntax keyword typescriptDocTags contained const dict expose inheritDoc interface nosideeffects override protected struct internal | 307 syntax keyword typescriptDocTags contained const dict expose inheritDoc interface nosideeffects override protected struct internal |
309 syntax keyword typescriptDocTags contained example global | 308 syntax keyword typescriptDocTags contained example global |
309 syntax keyword typescriptDocTags contained alpha beta defaultValue eventProperty experimental label | |
310 syntax keyword typescriptDocTags contained packageDocumentation privateRemarks remarks sealed typeParam | |
310 | 311 |
311 " syntax keyword typescriptDocTags contained ngdoc nextgroup=typescriptDocNGDirective | 312 " syntax keyword typescriptDocTags contained ngdoc nextgroup=typescriptDocNGDirective |
312 syntax keyword typescriptDocTags contained ngdoc scope priority animations | 313 syntax keyword typescriptDocTags contained ngdoc scope priority animations |
313 syntax keyword typescriptDocTags contained ngdoc restrict methodOf propertyOf eventOf eventType nextgroup=typescriptDocParam skipwhite | 314 syntax keyword typescriptDocTags contained ngdoc restrict methodOf propertyOf eventOf eventType nextgroup=typescriptDocParam skipwhite |
314 syntax keyword typescriptDocNGDirective contained overview service object function method property event directive filter inputType error | 315 syntax keyword typescriptDocNGDirective contained overview service object function method property event directive filter inputType error |
406 \ typescriptTypeReference, | 407 \ typescriptTypeReference, |
407 \ typescriptObjectType, | 408 \ typescriptObjectType, |
408 \ typescriptTupleType, | 409 \ typescriptTupleType, |
409 \ typescriptTypeQuery, | 410 \ typescriptTypeQuery, |
410 \ typescriptStringLiteralType, | 411 \ typescriptStringLiteralType, |
411 \ typescriptReadonlyArrayKeyword | 412 \ typescriptReadonlyArrayKeyword, |
413 \ typescriptAssertType | |
412 | 414 |
413 syntax region typescriptStringLiteralType contained | 415 syntax region typescriptStringLiteralType contained |
414 \ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ | 416 \ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ |
415 \ nextgroup=typescriptUnion | 417 \ nextgroup=typescriptUnion |
416 \ skipwhite skipempty | 418 \ skipwhite skipempty |
445 \ typescriptIndexSignature, | 447 \ typescriptIndexSignature, |
446 \ @typescriptMembers | 448 \ @typescriptMembers |
447 | 449 |
448 syntax region typescriptTupleType matchgroup=typescriptBraces | 450 syntax region typescriptTupleType matchgroup=typescriptBraces |
449 \ start=/\[/ end=/\]/ | 451 \ start=/\[/ end=/\]/ |
450 \ contains=@typescriptType | 452 \ contains=@typescriptType,@typescriptComments |
451 \ contained skipwhite oneline | 453 \ contained skipwhite |
452 | 454 |
453 syntax cluster typescriptTypeOperator | 455 syntax cluster typescriptTypeOperator |
454 \ contains=typescriptUnion,typescriptTypeBracket | 456 \ contains=typescriptUnion,typescriptTypeBracket |
455 | 457 |
456 syntax match typescriptUnion /|\|&/ contained nextgroup=@typescriptPrimaryType skipwhite skipempty | 458 syntax match typescriptUnion /|\|&/ contained nextgroup=@typescriptPrimaryType skipwhite skipempty |
481 | 483 |
482 syntax keyword typescriptUserDefinedType is | 484 syntax keyword typescriptUserDefinedType is |
483 \ contained nextgroup=@typescriptType skipwhite skipempty | 485 \ contained nextgroup=@typescriptType skipwhite skipempty |
484 | 486 |
485 syntax keyword typescriptTypeQuery typeof keyof | 487 syntax keyword typescriptTypeQuery typeof keyof |
488 \ nextgroup=typescriptTypeReference | |
489 \ contained skipwhite skipnl | |
490 | |
491 syntax keyword typescriptAssertType asserts | |
486 \ nextgroup=typescriptTypeReference | 492 \ nextgroup=typescriptTypeReference |
487 \ contained skipwhite skipnl | 493 \ contained skipwhite skipnl |
488 | 494 |
489 syntax cluster typescriptCallSignature contains=typescriptGenericCall,typescriptCall | 495 syntax cluster typescriptCallSignature contains=typescriptGenericCall,typescriptCall |
490 syntax region typescriptGenericCall matchgroup=typescriptTypeBrackets | 496 syntax region typescriptGenericCall matchgroup=typescriptTypeBrackets |
772 syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName clearTimeout | 778 syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName clearTimeout |
773 syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName setInterval | 779 syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName setInterval |
774 syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName clearInterval | 780 syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName clearInterval |
775 hi def link typescriptNodeGlobal Structure | 781 hi def link typescriptNodeGlobal Structure |
776 | 782 |
777 syntax keyword typescriptGlobal containedin=typescriptIdentifierName describe it test | 783 syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName describe |
778 syntax keyword typescriptGlobal containedin=typescriptIdentifierName before after | 784 syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName it test before |
779 syntax keyword typescriptGlobal containedin=typescriptIdentifierName beforeEach afterEach | 785 syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName after beforeEach |
780 syntax keyword typescriptGlobal containedin=typescriptIdentifierName beforeAll afterAll | 786 syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName afterEach |
781 syntax keyword typescriptGlobal containedin=typescriptIdentifierName expect assert | 787 syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName beforeAll |
788 syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName afterAll | |
789 syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName expect assert | |
782 | 790 |
783 "runtime syntax/yats/web.vim | 791 "runtime syntax/yats/web.vim |
784 syntax keyword typescriptBOM containedin=typescriptIdentifierName AbortController | 792 syntax keyword typescriptBOM containedin=typescriptIdentifierName AbortController |
785 syntax keyword typescriptBOM containedin=typescriptIdentifierName AbstractWorker AnalyserNode | 793 syntax keyword typescriptBOM containedin=typescriptIdentifierName AbstractWorker AnalyserNode |
786 syntax keyword typescriptBOM containedin=typescriptIdentifierName App Apps ArrayBuffer | 794 syntax keyword typescriptBOM containedin=typescriptIdentifierName App Apps ArrayBuffer |
1892 \ skipwhite skipempty | 1900 \ skipwhite skipempty |
1893 | 1901 |
1894 " matches `(a) =>` or `([a]) =>` or | 1902 " matches `(a) =>` or `([a]) =>` or |
1895 " `( | 1903 " `( |
1896 " a) =>` | 1904 " a) =>` |
1897 syntax match typescriptArrowFuncDef contained /(\(\_s*[a-zA-Z\$_\[]\_[^)]*\)*)\s*=>/ | 1905 syntax match typescriptArrowFuncDef contained /(\(\_s*[a-zA-Z\$_\[.]\_[^)]*\)*)\s*=>/ |
1898 \ contains=typescriptArrowFuncArg,typescriptArrowFunc | 1906 \ contains=typescriptArrowFuncArg,typescriptArrowFunc |
1899 \ nextgroup=@typescriptExpression,typescriptBlock | 1907 \ nextgroup=@typescriptExpression,typescriptBlock |
1900 \ skipwhite skipempty | 1908 \ skipwhite skipempty |
1901 | 1909 |
1902 syntax match typescriptArrowFuncDef contained /\K\k*\s*=>/ | 1910 syntax match typescriptArrowFuncDef contained /\K\k*\s*=>/ |
1933 \ nextgroup=typescriptReturnAnnotation,typescriptBlock | 1941 \ nextgroup=typescriptReturnAnnotation,typescriptBlock |
1934 \ contained skipwhite skipnl | 1942 \ contained skipwhite skipnl |
1935 | 1943 |
1936 "runtime syntax/basic/decorator.vim | 1944 "runtime syntax/basic/decorator.vim |
1937 syntax match typescriptDecorator /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/ | 1945 syntax match typescriptDecorator /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/ |
1938 \ nextgroup=typescriptArgumentList | 1946 \ nextgroup=typescriptArgumentList,typescriptTypeArguments |
1939 \ contains=@_semantic,typescriptDotNotation | 1947 \ contains=@_semantic,typescriptDotNotation |
1940 | 1948 |
1941 " Define the default highlighting. | 1949 " Define the default highlighting. |
1942 hi def link typescriptReserved Error | 1950 hi def link typescriptReserved Error |
1943 | 1951 |
1967 hi def link typescriptEventString String | 1975 hi def link typescriptEventString String |
1968 hi def link typescriptASCII Special | 1976 hi def link typescriptASCII Special |
1969 hi def link typescriptTemplateSB Label | 1977 hi def link typescriptTemplateSB Label |
1970 hi def link typescriptRegexpString String | 1978 hi def link typescriptRegexpString String |
1971 hi def link typescriptGlobal Constant | 1979 hi def link typescriptGlobal Constant |
1980 hi def link typescriptTestGlobal Function | |
1972 hi def link typescriptPrototype Type | 1981 hi def link typescriptPrototype Type |
1973 hi def link typescriptConditional Conditional | 1982 hi def link typescriptConditional Conditional |
1974 hi def link typescriptConditionalElse Conditional | 1983 hi def link typescriptConditionalElse Conditional |
1975 hi def link typescriptCase Conditional | 1984 hi def link typescriptCase Conditional |
1976 hi def link typescriptDefault typescriptCase | 1985 hi def link typescriptDefault typescriptCase |
2046 hi def link typescriptAliasKeyword Keyword | 2055 hi def link typescriptAliasKeyword Keyword |
2047 hi def link typescriptUserDefinedType Keyword | 2056 hi def link typescriptUserDefinedType Keyword |
2048 hi def link typescriptTypeReference Identifier | 2057 hi def link typescriptTypeReference Identifier |
2049 hi def link typescriptConstructor Keyword | 2058 hi def link typescriptConstructor Keyword |
2050 hi def link typescriptDecorator Special | 2059 hi def link typescriptDecorator Special |
2060 hi def link typescriptAssertType Keyword | |
2051 | 2061 |
2052 hi link typeScript NONE | 2062 hi link typeScript NONE |
2053 | 2063 |
2054 if exists('s:cpo_save') | 2064 if exists('s:cpo_save') |
2055 let &cpo = s:cpo_save | 2065 let &cpo = s:cpo_save |