neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit f25ffc43a78da13719d9646e5ccb308a791278b6
parent 3da8f4c7ee0d3d727bd8d160874ac55d661c3607
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sun, 10 Nov 2024 09:50:59 +0800

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:
Mruntime/syntax/vim.vim | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 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*)/