diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-11-10 09:50:59 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-11-10 10:03:20 +0800 |
commit | f25ffc43a78da13719d9646e5ccb308a791278b6 (patch) | |
tree | 0f877198adcca8a6e1a3fb049f343b6c851beb3b /runtime/syntax/vim.vim | |
parent | 3da8f4c7ee0d3d727bd8d160874ac55d661c3607 (diff) | |
download | rneovim-f25ffc43a78da13719d9646e5ccb308a791278b6.tar.gz rneovim-f25ffc43a78da13719d9646e5ccb308a791278b6.tar.bz2 rneovim-f25ffc43a78da13719d9646e5ccb308a791278b6.zip |
vim-patch:dfcef89: runtime(vim): Distinguish Vim9 constructor definitions from the :new ex command (vim/vim#14050)
With the arrival of Vim9 classes, the syntax must allow for
_new_ constructors; multiple constructor definitions are
supported for a class, provided distinct suffix-names are
used. Currently, the defined constructors match either
vimCommand or vimFunctionError (for any newBar).
For example:
------------------------------------------------------------
vim9script
class Foo
def new()
enddef
def newBar()
enddef
endclass
------------------------------------------------------------
Since every constructor is required to bear a lower-cased
_new_ prefix name, it should suffice to distinguish them
from functions, and so there are no new highlight or syntax
groups introduced.
https://github.com/vim/vim/commit/dfcef890cbdd3ec26de040b2e26d77444dc46862
Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
Diffstat (limited to 'runtime/syntax/vim.vim')
-rw-r--r-- | runtime/syntax/vim.vim | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 6e38076d35..e5623528ea 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -679,7 +679,8 @@ syn match vimUsrCmd '^\s*\zs\u\%(\w*\)\@>\%([(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@ " Errors And Warnings: {{{2 " ==================== if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimfunctionerror") - syn match vimFunctionError "\s\zs[a-z0-9]\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank + " TODO: The new-prefix exception should only apply to constructor definitions. + syn match vimFunctionError "\s\zs\%(new\)\@![a-z0-9]\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank syn match vimFunctionError "\s\zs\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\d\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank syn match vimElseIfErr "\<else\s\+if\>" syn match vimBufnrWarn /\<bufnr\s*(\s*["']\.['"]\s*)/ |