runtime(typescript): update outdated syntax files Commit: https://github.com/vim/vim/commit/5e4571508480c8f51748e49fb05c1891db0cb803 Author: rhysd <lin90...@yahoo.co.jp> Date: Fri May 24 18:59:10 2024 +0200
runtime(typescript): update outdated syntax files fixes: https://github.com/vim/vim/issues/14721 fixes: HerringtonDarkholme/yats.vimhttps://github.com/vim/vim/issues/277 closes: #14840 Signed-off-by: rhysd <lin90...@yahoo.co.jp> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS index 999bec76f..fd80c530f 100644 --- a/.github/MAINTAINERS +++ b/.github/MAINTAINERS @@ -516,9 +516,9 @@ runtime/syntax/toml.vim @averms runtime/syntax/tt2.vim @petdance runtime/syntax/tt2html.vim @petdance runtime/syntax/tt2js.vim @petdance -runtime/syntax/typescript.vim @HerringtonDarkholme -runtime/syntax/typescriptcommon.vim @HerringtonDarkholme -runtime/syntax/typescriptreact.vim @HerringtonDarkholme +runtime/syntax/typescript.vim @HerringtonDarkholme @rhysd +runtime/syntax/typescriptreact.vim @HerringtonDarkholme @rhysd +runtime/syntax/shared/typescriptcommon.vim @HerringtonDarkholme @rhysd runtime/syntax/unison.vim @chuwy runtime/syntax/vdf.vim @ObserverOfTime runtime/syntax/vroom.vim @dbarnett diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index bbdda4f9d..0c2ecaef5 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 9.1. Last change: 2024 May 11 +*syntax.txt* For Vim version 9.1. Last change: 2024 May 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3764,6 +3764,19 @@ set "tf_minlines" to the value you desire. Example: > :let tf_minlines = your choice < +TYPESCRIPT *typescript.vim* *ft-typescript-syntax* + *typescriptreact.vim* *ft-typescriptreact-syntax* + +There is one option to control the TypeScript syntax highlighting. + + *g:typescript_host_keyword* +When this variable is set to 1, host-specific APIs such as `addEventListener` +are highlighted. To disable set it to zero in your .vimrc: > + + let g:typescript_host_keyword = 0 +< +The default value is 1. + VIM *vim.vim* *ft-vim-syntax* *g:vimsyn_minlines* *g:vimsyn_maxlines* There is a trade-off between more accurate syntax highlighting versus screen diff --git a/runtime/doc/tags b/runtime/doc/tags index 115c071aa..8e3af7fe5 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -7392,6 +7392,8 @@ ft-termcap-syntax syntax.txt /*ft-termcap-syntax* ft-tex-plugin filetype.txt /*ft-tex-plugin* ft-tex-syntax syntax.txt /*ft-tex-syntax* ft-tf-syntax syntax.txt /*ft-tf-syntax* +ft-typescript-syntax syntax.txt /*ft-typescript-syntax* +ft-typescriptreact-syntax syntax.txt /*ft-typescriptreact-syntax* ft-vb-syntax syntax.txt /*ft-vb-syntax* ft-verilog-indent indent.txt /*ft-verilog-indent* ft-vhdl-indent indent.txt /*ft-vhdl-indent* @@ -7698,6 +7700,7 @@ g:tex_stylish syntax.txt /*g:tex_stylish* g:tex_subscripts syntax.txt /*g:tex_subscripts* g:tex_superscripts syntax.txt /*g:tex_superscripts* g:tex_verbspell syntax.txt /*g:tex_verbspell* +g:typescript_host_keyword syntax.txt /*g:typescript_host_keyword* g:var eval.txt /*g:var* g:vim_indent indent.txt /*g:vim_indent* g:vim_indent_cont indent.txt /*g:vim_indent_cont* @@ -10745,6 +10748,8 @@ type-inference vim9.txt /*type-inference* type-mistakes tips.txt /*type-mistakes* typealias vim9class.txt /*typealias* typename() builtin.txt /*typename()* +typescript.vim syntax.txt /*typescript.vim* +typescriptreact.vim syntax.txt /*typescriptreact.vim* u undo.txt /*u* uganda uganda.txt /*uganda* uganda.txt uganda.txt /*uganda.txt* diff --git a/runtime/syntax/shared/typescriptcommon.vim b/runtime/syntax/shared/typescriptcommon.vim index d06525115..3af79a38f 100644 --- a/runtime/syntax/shared/typescriptcommon.vim +++ b/runtime/syntax/shared/typescriptcommon.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: TypeScript and TypeScriptReact " Maintainer: Herrington Darkholme -" Last Change: 2023 Aug 24 +" Last Change: 2024 May 24 " Based On: Herrington Darkholme's yats.vim " Changes: See https://github.com/HerringtonDarkholme/yats.vim " Credits: See yats.vim on github @@ -49,13 +49,13 @@ syntax match typescriptProp contained /\K\k*!\?/ \ nextgroup=@afterIdentifier \ skipwhite skipempty -syntax region typescriptIndexExpr contained matchgroup=typescriptProperty start=/\[/rs=s+1 end=/]/he=e-1 contains=@typescriptValue nextgroup=@typescriptSymbols,typescriptDotNotation,typescriptFuncCallArg skipwhite skipempty +syntax region typescriptIndexExpr contained matchgroup=typescriptProperty start=/\[/ end=/]/ contains=@typescriptValue,typescriptCastKeyword nextgroup=@typescriptSymbols,typescriptDotNotation,typescriptFuncCallArg skipwhite skipempty 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 -syntax region typescriptFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptValue,@typescriptComments nextgroup=@typescriptSymbols,typescriptDotNotation skipwhite skipempty skipnl +syntax region typescriptFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptValue,@typescriptComments,typescriptCastKeyword nextgroup=@typescriptSymbols,typescriptDotNotation skipwhite skipempty skipnl syntax region typescriptEventFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptEventExpression syntax region typescriptEventString contained start=/\z(["']\)/ skip=/\\\|\\z1\|\ / end=/\z1\|$/ contains=typescriptASCII,@events @@ -116,20 +116,33 @@ syntax match typescriptASCII contained /\\d\d\d/ syntax region typescriptTemplateSubstitution matchgroup=typescriptTemplateSB \ start=/\${/ end=/}/ - \ contains=@typescriptValue + \ contains=@typescriptValue,typescriptCastKeyword \ contained -syntax region typescriptString +syntax region typescriptString \ start=+\z(["']\)+ skip=+\\%(\z1\|$\)+ end=+\z1+ end=+$+ \ contains=typescriptSpecial,@Spell + \ nextgroup=@typescriptSymbols + \ skipwhite skipempty \ extend syntax match typescriptSpecial contained " \%(x\x\x|u%(\x{4}|\{\x{1,6}})|c\u|.)" -" From vim runtime -" <https://github.com/vim/vim/blob/master/runtime/syntax/javascript.vim#L48> -syntax region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\|\/+ end=+/[gimuy]\{0,5\}\s*$+ end=+/[gimuy]\{0,5\}\s*[;.,)\]}:]+me=e-1 nextgroup=typescriptDotNotation oneline +" From pangloss/vim-javascript +" <https://github.com/pangloss/vim-javascript/blob/d6e137563c47fb59f26ed25d044c0c7532304f18/syntax/javascript.vim#L64-L72> +syntax region typescriptRegexpCharClass contained start=+\[+ skip=+\.+ end=+\]+ contains=typescriptSpecial extend +syntax match typescriptRegexpBoundary contained " -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1sAYVU-004lix-9f%40256bit.org.