diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-10-03 09:50:41 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-10-05 23:20:45 -0400 |
commit | 95fd5ed8c952546832a2b7c54c3a0b5c0eaeb949 (patch) | |
tree | 909263a63341a582737b9d3dc040997ffd697fd6 | |
parent | 0f1d679531e56c5cb8180abc56b466668e68800f (diff) | |
download | rneovim-95fd5ed8c952546832a2b7c54c3a0b5c0eaeb949.tar.gz rneovim-95fd5ed8c952546832a2b7c54c3a0b5c0eaeb949.tar.bz2 rneovim-95fd5ed8c952546832a2b7c54c3a0b5c0eaeb949.zip |
runtime/typescript: 91359014b359cf816bf943fe2c7d492996263def
Port typescript syntax changes only.
https://github.com/vim/vim/commit/91359014b359cf816bf943fe2c7d492996263def
-rw-r--r-- | runtime/syntax/typescript.vim | 11 | ||||
-rw-r--r-- | runtime/syntax/typescriptcommon.vim | 44 | ||||
-rw-r--r-- | runtime/syntax/typescriptreact.vim | 2 |
3 files changed, 35 insertions, 22 deletions
diff --git a/runtime/syntax/typescript.vim b/runtime/syntax/typescript.vim index 475cb8dae4..767ba56d42 100644 --- a/runtime/syntax/typescript.vim +++ b/runtime/syntax/typescript.vim @@ -1,10 +1,13 @@ " Vim syntax file " Language: TypeScript -" Maintainer: Bram Moolenaar -" Last Change: 2019 Nov 17 +" Maintainer: Bram Moolenaar, Herrington Darkholme +" Last Change: 2019 Nov 30 " Based On: Herrington Darkholme's yats.vim -" Changes: See https:github.com/HerringtonDarkholme/yats.vim -" Credits: See yats.vim on github +" Changes: Go to https:github.com/HerringtonDarkholme/yats.vim for recent changes. +" Origin: https://github.com/othree/yajs +" Credits: Kao Wei-Ko(othree), Jose Elera Campana, Zhao Yi, Claudio Fleiner, Scott Shattuck +" (This file is based on their hard work), gumnos (From the #vim +" IRC Channel in Freenode) " This is the same syntax that is in yats.vim, but: " - flattened into one file diff --git a/runtime/syntax/typescriptcommon.vim b/runtime/syntax/typescriptcommon.vim index 3febcc7cb5..ff53168329 100644 --- a/runtime/syntax/typescriptcommon.vim +++ b/runtime/syntax/typescriptcommon.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: TypeScript and TypeScriptReact -" Maintainer: Bram Moolenaar -" Last Change: 2019 Nov 17 +" Maintainer: Bram Moolenaar, Herrington Darkholme +" Last Change: 2019 Nov 30 " Based On: Herrington Darkholme's yats.vim " Changes: See https:github.com/HerringtonDarkholme/yats.vim " Credits: See yats.vim on github @@ -11,14 +11,13 @@ if &cpo =~ 'C' set cpo&vim endif -" runtime syntax/common.vim " NOTE: this results in accurate highlighting, but can be slow. syntax sync fromstart "Dollar sign is permitted anywhere in an identifier setlocal iskeyword-=$ -if main_syntax == 'typescript' || main_syntax == 'typescript.tsx' +if main_syntax == 'typescript' || main_syntax == 'typescriptreact' setlocal iskeyword+=$ " syntax cluster htmlJavaScript contains=TOP endif @@ -53,7 +52,7 @@ syntax match typescriptProp contained /\K\k*!\?/ syntax region typescriptIndexExpr contained matchgroup=typescriptProperty start=/\[/rs=s+1 end=/]/he=e-1 contains=@typescriptValue nextgroup=@typescriptSymbols,typescriptDotNotation,typescriptFuncCallArg skipwhite skipempty -syntax match typescriptDotNotation /\./ nextgroup=typescriptProp skipnl +syntax match typescriptDotNotation /\.\|?\.\|!\./ nextgroup=typescriptProp skipnl syntax match typescriptDotStyleNotation /\.style\./ nextgroup=typescriptDOMStyle transparent " syntax match typescriptFuncCall contained /[a-zA-Z]\k*\ze(/ nextgroup=typescriptFuncCallArg syntax region typescriptParenExp matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptComments,@typescriptValue,typescriptCastKeyword nextgroup=@typescriptSymbols skipwhite skipempty @@ -143,7 +142,7 @@ syntax match typescriptUnaryOp /[+\-~!]/ \ nextgroup=@typescriptValue \ skipwhite -syntax region typescriptTernary matchgroup=typescriptTernaryOp start=/?/ end=/:/ contained contains=@typescriptValue,@typescriptComments nextgroup=@typescriptValue skipwhite skipempty +syntax region typescriptTernary matchgroup=typescriptTernaryOp start=/?[.?]\@!/ end=/:/ contained contains=@typescriptValue,@typescriptComments nextgroup=@typescriptValue skipwhite skipempty syntax match typescriptAssign /=/ nextgroup=@typescriptValue \ skipwhite skipempty @@ -177,7 +176,7 @@ syntax match typescriptBinaryOp contained /\*\*=\?/ nextgroup=@typescriptValue syntax cluster typescriptSymbols contains=typescriptBinaryOp,typescriptKeywordOp,typescriptTernary,typescriptAssign,typescriptCastKeyword -"" runtime syntax/basic/reserved.vim +" runtime syntax/basic/reserved.vim "runtime syntax/basic/keyword.vim "Import @@ -307,6 +306,8 @@ syntax match typescriptDocNotation contained /@/ nextgroup=typescrip syntax keyword typescriptDocTags contained constant constructor constructs function ignore inner private public readonly static syntax keyword typescriptDocTags contained const dict expose inheritDoc interface nosideeffects override protected struct internal syntax keyword typescriptDocTags contained example global +syntax keyword typescriptDocTags contained alpha beta defaultValue eventProperty experimental label +syntax keyword typescriptDocTags contained packageDocumentation privateRemarks remarks sealed typeParam " syntax keyword typescriptDocTags contained ngdoc nextgroup=typescriptDocNGDirective syntax keyword typescriptDocTags contained ngdoc scope priority animations @@ -408,7 +409,8 @@ syntax cluster typescriptPrimaryType contains= \ typescriptTupleType, \ typescriptTypeQuery, \ typescriptStringLiteralType, - \ typescriptReadonlyArrayKeyword + \ typescriptReadonlyArrayKeyword, + \ typescriptAssertType syntax region typescriptStringLiteralType contained \ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ @@ -447,8 +449,8 @@ syntax cluster typescriptTypeMember contains= syntax region typescriptTupleType matchgroup=typescriptBraces \ start=/\[/ end=/\]/ - \ contains=@typescriptType - \ contained skipwhite oneline + \ contains=@typescriptType,@typescriptComments + \ contained skipwhite syntax cluster typescriptTypeOperator \ contains=typescriptUnion,typescriptTypeBracket @@ -486,6 +488,10 @@ syntax keyword typescriptTypeQuery typeof keyof \ nextgroup=typescriptTypeReference \ contained skipwhite skipnl +syntax keyword typescriptAssertType asserts + \ nextgroup=typescriptTypeReference + \ contained skipwhite skipnl + syntax cluster typescriptCallSignature contains=typescriptGenericCall,typescriptCall syntax region typescriptGenericCall matchgroup=typescriptTypeBrackets \ start=/</ end=/>/ @@ -774,11 +780,13 @@ if get(g:, 'yats_host_keyword', 1) syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName clearInterval hi def link typescriptNodeGlobal Structure - syntax keyword typescriptGlobal containedin=typescriptIdentifierName describe it test - syntax keyword typescriptGlobal containedin=typescriptIdentifierName before after - syntax keyword typescriptGlobal containedin=typescriptIdentifierName beforeEach afterEach - syntax keyword typescriptGlobal containedin=typescriptIdentifierName beforeAll afterAll - syntax keyword typescriptGlobal containedin=typescriptIdentifierName expect assert + syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName describe + syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName it test before + syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName after beforeEach + syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName afterEach + syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName beforeAll + syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName afterAll + syntax keyword typescriptTestGlobal containedin=typescriptIdentifierName expect assert "runtime syntax/yats/web.vim syntax keyword typescriptBOM containedin=typescriptIdentifierName AbortController @@ -1894,7 +1902,7 @@ syntax match typescriptArrowFuncDef contained /({\_[^}]*}\(:\_[^)]\)\ " matches `(a) =>` or `([a]) =>` or " `( " a) =>` -syntax match typescriptArrowFuncDef contained /(\(\_s*[a-zA-Z\$_\[]\_[^)]*\)*)\s*=>/ +syntax match typescriptArrowFuncDef contained /(\(\_s*[a-zA-Z\$_\[.]\_[^)]*\)*)\s*=>/ \ contains=typescriptArrowFuncArg,typescriptArrowFunc \ nextgroup=@typescriptExpression,typescriptBlock \ skipwhite skipempty @@ -1935,7 +1943,7 @@ syntax region typescriptParamImpl matchgroup=typescriptParens "runtime syntax/basic/decorator.vim syntax match typescriptDecorator /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/ - \ nextgroup=typescriptArgumentList + \ nextgroup=typescriptArgumentList,typescriptTypeArguments \ contains=@_semantic,typescriptDotNotation " Define the default highlighting. @@ -1969,6 +1977,7 @@ hi def link typescriptASCII Special hi def link typescriptTemplateSB Label hi def link typescriptRegexpString String hi def link typescriptGlobal Constant +hi def link typescriptTestGlobal Function hi def link typescriptPrototype Type hi def link typescriptConditional Conditional hi def link typescriptConditionalElse Conditional @@ -2048,6 +2057,7 @@ hi def link typescriptUserDefinedType Keyword hi def link typescriptTypeReference Identifier hi def link typescriptConstructor Keyword hi def link typescriptDecorator Special +hi def link typescriptAssertType Keyword hi link typeScript NONE diff --git a/runtime/syntax/typescriptreact.vim b/runtime/syntax/typescriptreact.vim index 5a521c9fbc..f29fe785b9 100644 --- a/runtime/syntax/typescriptreact.vim +++ b/runtime/syntax/typescriptreact.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: TypeScript with React (JSX) " Maintainer: Bram Moolenaar -" Last Change: 2019 Nov 17 +" Last Change: 2019 Nov 30 " Based On: Herrington Darkholme's yats.vim " Changes: See https:github.com/HerringtonDarkholme/yats.vim " Credits: See yats.vim on github |