vim-patch:97501af: runtime(vim): Update base syntax, match "any" type distinctly

Allow for special highlighting of the "any" Vim9 type.

Addresses comment
https://github.com/vim/vim/pull/17722#issuecomment-3075531052

closes: vim/vim#17769

97501afda3

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
This commit is contained in:
zeertzjq
2025-07-19 06:01:00 +08:00
parent f2691199fa
commit 73943eb0d1

View File

@@ -534,14 +534,15 @@ syn region vimReturnType contained
syn match vimParamType contained ":\s" skipwhite skipnl nextgroup=@vimType contains=vimTypeSep syn match vimParamType contained ":\s" skipwhite skipnl nextgroup=@vimType contains=vimTypeSep
syn match vimTypeSep contained ":\%(\s\|\n\)\@=" skipwhite nextgroup=@vimType syn match vimTypeSep contained ":\%(\s\|\n\)\@=" skipwhite nextgroup=@vimType
syn keyword vimType contained any blob bool channel float job number string void syn keyword vimType contained blob bool channel float job number string void
syn keyword vimTypeAny contained any
syn match vimType contained "\<\%(func\)\>" syn match vimType contained "\<\%(func\)\>"
syn region vimCompoundType contained matchgroup=vimType start="\<func(" end=")" nextgroup=vimTypeSep contains=@vim9Continue,@vimType transparent syn region vimCompoundType contained matchgroup=vimType start="\<func(" end=")" nextgroup=vimTypeSep contains=@vim9Continue,@vimType transparent
syn region vimCompoundType contained matchgroup=vimType start="\<tuple<" end=">" contains=@vim9Continue,@vimType transparent syn region vimCompoundType contained matchgroup=vimType start="\<tuple<" end=">" contains=@vim9Continue,@vimType transparent
syn region vimCompoundType contained matchgroup=vimType start="\<\%(list\|dict\)<" end=">" contains=@vimType oneline transparent syn region vimCompoundType contained matchgroup=vimType start="\<\%(list\|dict\)<" end=">" contains=@vimType oneline transparent
syn match vimUserType contained "\<\%(\h\w*\.\)*\u\w*\>" syn match vimUserType contained "\<\%(\h\w*\.\)*\u\w*\>"
syn cluster vimType contains=vimType,vimCompoundType,vimUserType syn cluster vimType contains=vimType,vimTypeAny,vimCompoundType,vimUserType
" Classes, Enums And Interfaces: {{{2 " Classes, Enums And Interfaces: {{{2
" ============================= " =============================
@@ -1055,7 +1056,8 @@ syn match vim9Variable contained "\<\h\w*\>" skipwhite nextgroup=vim9VariableTyp
syn region vim9VariableList contained start="\[" end="]" contains=@vimContinue,@vimSpecialVar,vim9Variable skipwhite nextgroup=vimLetHeredoc syn region vim9VariableList contained start="\[" end="]" contains=@vimContinue,@vimSpecialVar,vim9Variable skipwhite nextgroup=vimLetHeredoc
syn match vim9VariableTypeSep contained "\S\@1<=:\%(\s\|\n\)\@=" skipwhite nextgroup=@vim9VariableType syn match vim9VariableTypeSep contained "\S\@1<=:\%(\s\|\n\)\@=" skipwhite nextgroup=@vim9VariableType
syn keyword vim9VariableType contained any blob bool channel float job number string void skipwhite nextgroup=vimLetHeredoc syn keyword vim9VariableType contained blob bool channel float job number string void skipwhite nextgroup=vimLetHeredoc
syn keyword vim9VariableTypeAny contained any skipwhite nextgroup=vimLetHeredoc
syn match vim9VariableType contained "\<\%(func\)\>" skipwhite nextgroup=vimLetHeredoc syn match vim9VariableType contained "\<\%(func\)\>" skipwhite nextgroup=vimLetHeredoc
syn region vim9VariableCompoundType contained syn region vim9VariableCompoundType contained
\ matchgroup=vim9VariableType \ matchgroup=vim9VariableType
@@ -1081,7 +1083,7 @@ syn region vim9VariableCompoundType contained
\ transparent \ transparent
syn match vim9VariableUserType contained "\<\%(\h\w*\.\)*\u\w*\>" skipwhite nextgroup=vimLetHeredoc syn match vim9VariableUserType contained "\<\%(\h\w*\.\)*\u\w*\>" skipwhite nextgroup=vimLetHeredoc
syn cluster vim9VariableType contains=vim9VariableType,vim9VariableCompoundType,vim9VariableUserType syn cluster vim9VariableType contains=vim9VariableType,vim9VariableTypeAny,vim9VariableCompoundType,vim9VariableUserType
" Lockvar and Unlockvar: {{{2 " Lockvar and Unlockvar: {{{2
" ===================== " =====================
@@ -2426,6 +2428,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimThrow vimCommand hi def link vimThrow vimCommand
hi def link vimTodo Todo hi def link vimTodo Todo
hi def link vimType Type hi def link vimType Type
hi def link vimTypeAny vimType
hi def link vimUniq vimCommand hi def link vimUniq vimCommand
hi def link vimUniqBang vimBang hi def link vimUniqBang vimBang
hi def link vimUniqOptions Special hi def link vimUniqOptions Special
@@ -2516,6 +2519,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vim9TypeEquals vimOper hi def link vim9TypeEquals vimOper
hi def link vim9Variable vimVar hi def link vim9Variable vimVar
hi def link vim9VariableType vimType hi def link vim9VariableType vimType
hi def link vim9VariableTypeAny vimType
hi def link vim9Var vimCommand hi def link vim9Var vimCommand
hi def link vim9Vim9ScriptArg Special hi def link vim9Vim9ScriptArg Special
hi def link vim9Vim9Script vimCommand hi def link vim9Vim9Script vimCommand