1
0
forked from aniani/vim

runtime(vim): Update base-syntax, improve function definition matching

- Fix highlighting of function names including /fu\%[nction]/ (E.g.,
  s:func(), foo.fu(), fu.func())
- Match :delfunction argument.

Reported by Aliaksei Budavei.

closes: #17428

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Doug Kearns
2025-06-11 21:16:14 +02:00
committed by Christian Brabandt
parent 6cc9bd4001
commit 51289207f8
52 changed files with 868 additions and 467 deletions

View File

@@ -66,10 +66,48 @@ function <SID>Foo()
return 42
endfunction
function b:dict.Foo()
return 42
endfunction
function w:dict.Foo()
return 42
endfunction
function t:dict.Foo()
return 42
endfunction
function g:dict.Foo()
return 42
endfunction
function s:dict.Foo()
return 42
endfunction
function v:dict.Foo()
return 42
endfunction
function Foo(arg)
let l:dict = {}
function l:dict.BAR()
return 42
endfunction
function a:arg.BAR()
return 42
endfunction
endfunction
function foo#bar#Foo()
return 42
endfunction
function g:foo#bar#Foo()
return 42
endfunction
" same name as an Ex command
function s:ls()
endfunction
@@ -154,6 +192,14 @@ function Foo(
return 42
endfunction
function Foo(
x,
y,
z,
...)
return 42
endfunction
function Foo(x, y = 42, z = "zed")
return 42
endfunction
@@ -165,6 +211,13 @@ function Foo(
return 42
endfunction
function Foo(
x,
y = 42,
z = "zed")
return 42
endfunction
" arguments
@@ -179,6 +232,12 @@ function Foo(...)
endfunction
" Issue #16243 (Vim script def parameters syntax highlight is wrong)
function Test(lines = [line('.'), line('.')])
endfunction
" comments
function Foo()
@@ -200,12 +259,12 @@ echo "Foo" | function Foo()
endfunction
" delete function
delfunction Foo
delfunction foo.bar
delfunction! Foo
delfunction foo.bar
" Issue https://github.com/vim/vim/pull/17420#issuecomment-2927798687
" (function named /s:fu%\[nction]/)
func! s:func(_, func)
return a:func
endfunc
" fold-region ending