summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/testdir/input
diff options
context:
space:
mode:
authordkearns <dougkearns@gmail.com>2024-04-15 04:32:56 +1000
committerGitHub <noreply@github.com>2024-04-14 20:32:56 +0200
commit4ba70cab37d2a625d8c59bb136070ef9d1976934 (patch)
treeb08db573f2267ff4c35d64afc2aab959473c5856 /runtime/syntax/testdir/input
parentc59a8648b2d8b3e17f12cd45f74a31b1aa385d2d (diff)
runtime(vim): Update base-syntax, fix nested function folding (#14397)
Only match function folding start and end patterns at the start of a line, excluding heredocs and :append/:change/:insert commands. Fixes #14393 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Diffstat (limited to 'runtime/syntax/testdir/input')
-rw-r--r--runtime/syntax/testdir/input/vim_ex_def_fold.vim20
-rw-r--r--runtime/syntax/testdir/input/vim_ex_def_nested.vim20
-rw-r--r--runtime/syntax/testdir/input/vim_ex_def_nested_fold.vim22
-rw-r--r--runtime/syntax/testdir/input/vim_ex_function_fold.vim40
-rw-r--r--runtime/syntax/testdir/input/vim_ex_function_nested.vim38
-rw-r--r--runtime/syntax/testdir/input/vim_ex_function_nested_fold.vim40
6 files changed, 180 insertions, 0 deletions
diff --git a/runtime/syntax/testdir/input/vim_ex_def_fold.vim b/runtime/syntax/testdir/input/vim_ex_def_fold.vim
index 865fc5a919..3326075a3e 100644
--- a/runtime/syntax/testdir/input/vim_ex_def_fold.vim
+++ b/runtime/syntax/testdir/input/vim_ex_def_fold.vim
@@ -108,3 +108,23 @@ def Foo()
"useless string"
enddef
+
+" fold-region ending
+
+def Foo()
+ # enddef
+enddef
+
+def Foo()
+ echo "enddef"
+enddef
+
+def Foo()
+ let x =<< END
+ endfunction
+ END
+enddef
+
+:def Foo()
+:enddef
+
diff --git a/runtime/syntax/testdir/input/vim_ex_def_nested.vim b/runtime/syntax/testdir/input/vim_ex_def_nested.vim
new file mode 100644
index 0000000000..008c41520a
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_ex_def_nested.vim
@@ -0,0 +1,20 @@
+vim9script
+# Vim9 :def command (nested)
+
+class Test
+ const name: string
+
+ def new()
+ def Name(): string
+ function GiveName()
+ return "any"
+ endfunction
+
+ return GiveName()
+ enddef
+
+ this.name = Name()
+ enddef
+endclass
+
+echo Test.new()
diff --git a/runtime/syntax/testdir/input/vim_ex_def_nested_fold.vim b/runtime/syntax/testdir/input/vim_ex_def_nested_fold.vim
new file mode 100644
index 0000000000..601f553568
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_ex_def_nested_fold.vim
@@ -0,0 +1,22 @@
+vim9script
+# Vim9 :def command (nested)
+# VIM_TEST_SETUP let g:vimsyn_folding = 'f'
+# VIM_TEST_SETUP setl fdc=2 fdm=syntax
+
+class Test
+ const name: string
+
+ def new()
+ def Name(): string
+ function GiveName()
+ return "any"
+ endfunction
+
+ return GiveName()
+ enddef
+
+ this.name = Name()
+ enddef
+endclass
+
+echo Test.new()
diff --git a/runtime/syntax/testdir/input/vim_ex_function_fold.vim b/runtime/syntax/testdir/input/vim_ex_function_fold.vim
index f9d9bee47c..dd260ca450 100644
--- a/runtime/syntax/testdir/input/vim_ex_function_fold.vim
+++ b/runtime/syntax/testdir/input/vim_ex_function_fold.vim
@@ -181,3 +181,43 @@ delfunction foo.bar
delfunction! Foo
delfunction foo.bar
+
+" fold-region ending
+
+function Foo()
+ " endfunction
+endfunction
+
+function Foo()
+ echo "endfunction"
+endfunction
+
+function Foo()
+ let x =<< END
+ endfunction
+ END
+
+endfunction
+
+function Foo()
+ append
+ endfunction
+.
+endfunction
+
+function Foo()
+ change
+ endfunction
+.
+
+endfunction
+
+function Foo()
+ insert
+ endfunction
+.
+endfunction
+
+:function Foo()
+:endfunction
+
diff --git a/runtime/syntax/testdir/input/vim_ex_function_nested.vim b/runtime/syntax/testdir/input/vim_ex_function_nested.vim
new file mode 100644
index 0000000000..749b57238e
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_ex_function_nested.vim
@@ -0,0 +1,38 @@
+" Vim :def and :function commands (nested)
+
+def FunA(): string
+ def DoFunA(): string
+ return "."
+ enddef
+
+ return DoFunA()
+enddef
+
+def FunB(): string
+ function DoFunB()
+ return ".."
+ endfunction
+
+ return DoFunB()
+enddef
+
+function FunC()
+ def DoFunC(): string
+ return "..."
+ enddef
+
+ return DoFunC()
+endfunction
+
+function FunD()
+ function DoFunD()
+ return "...."
+ endfunction
+
+ return DoFunD()
+endfunction
+
+echo FunA()
+echo FunB()
+echo FunC()
+echo FunD()
diff --git a/runtime/syntax/testdir/input/vim_ex_function_nested_fold.vim b/runtime/syntax/testdir/input/vim_ex_function_nested_fold.vim
new file mode 100644
index 0000000000..d966ef386d
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_ex_function_nested_fold.vim
@@ -0,0 +1,40 @@
+" Vim :def and :function commands (nested)
+" VIM_TEST_SETUP let g:vimsyn_folding = 'f'
+" VIM_TEST_SETUP setl fdc=2 fdm=syntax
+
+def FunA(): string
+ def DoFunA(): string
+ return "."
+ enddef
+
+ return DoFunA()
+enddef
+
+def FunB(): string
+ function DoFunB()
+ return ".."
+ endfunction
+
+ return DoFunB()
+enddef
+
+function FunC()
+ def DoFunC(): string
+ return "..."
+ enddef
+
+ return DoFunC()
+endfunction
+
+function FunD()
+ function DoFunD()
+ return "...."
+ endfunction
+
+ return DoFunD()
+endfunction
+
+echo FunA()
+echo FunB()
+echo FunC()
+echo FunD()