0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

runtime(vim): Update base-syntax, improve folding function matches

- Allow function command modifiers.
- Match function bodies starting with empty lines.

Command modifiers reported by @Konfekt.

fixes #15671
closes: #15674

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Doug Kearns
2024-09-19 19:51:59 +02:00
committed by Christian Brabandt
parent e019f3626d
commit 35699f1749
48 changed files with 776 additions and 362 deletions

View File

@@ -107,3 +107,15 @@ def Foo()
"useless string"
enddef
" leading command separator
echo "Foo" | def Foo()
enddef
" command modifiers
silent! def Foo()
enddef

View File

@@ -1,5 +1,6 @@
" Vim :def command
" VIM_TEST_SETUP let g:vimsyn_folding = "f" | set fdm=syntax
" VIM_TEST_SETUP let g:vimsyn_folding = "f"
" VIM_TEST_SETUP setl fdc=2 fdl=999 fdm=syntax
" list
@@ -109,6 +110,18 @@ def Foo()
enddef
" command modifiers
silent! def Foo()
enddef
" leading command separator
echo "Foo" | def Foo()
enddef
" fold-region ending
def Foo()
@@ -128,3 +141,45 @@ enddef
:def Foo()
:enddef
" Issue #15671
" No recognition of :fun or :def bodies commencing with empty lines if
" g:vimsyn_folding contains "f"
def MA1()
return
enddef
def MA2()
return
enddef
def MB1(): void
return
enddef
def MB2(): void
return
enddef
def MC1(_: any)
return
enddef
def MC2(_: any)
return
enddef
def MD1(_: any): void
return
enddef
def MD2(_: any): void
return
enddef

View File

@@ -173,6 +173,18 @@ function Foo()
endfunction
" command modifiers
silent! function Foo()
endfunction
" leading command separator
echo "Foo" | function Foo()
endfunction
" delete function
delfunction Foo

View File

@@ -1,5 +1,6 @@
" Vim :function command
" VIM_TEST_SETUP let g:vimsyn_folding = "f" | set fdm=syntax
" VIM_TEST_SETUP let g:vimsyn_folding = "f"
" VIM_TEST_SETUP setl fdc=2 fdl=999 fdm=syntax
" list
@@ -174,6 +175,18 @@ function Foo()
endfunction
" command modifiers
silent! function Foo()
endfunction
" leading command separator
echo "Foo" | function Foo()
endfunction
" delete function
delfunction Foo
@@ -220,3 +233,45 @@ endfunction
:function Foo()
:endfunction
" Issue #15671
" No recognition of :fun or :def bodies commencing with empty lines if
" g:vimsyn_folding contains "f"
fun FA1()
return
endfun
fun FA2()
return
endfun
fun FB1() abort
return
endfun
fun FB2() abort
return
endfun
fun FC1(_)
return
endfun
fun FC2(_)
return
endfun
fun FD1(_) abort
return
endfun
fun FD2(_) abort
return
endfun