changeset 31772:152bb9e6b4b4 v9.0.1218

patch 9.0.1218: completion includes functions that don't work Commit: https://github.com/vim/vim/commit/90c2353365c5da40dec01b09e1f482983cf7f55d Author: Kota Kato <github@kat0h.com> Date: Wed Jan 18 15:27:38 2023 +0000 patch 9.0.1218: completion includes functions that don't work Problem: Completion includes functions that don't work. Solution: Skip functions that are not implemented. (Kota Kato, closes #11845)
author Bram Moolenaar <Bram@vim.org>
date Wed, 18 Jan 2023 16:30:06 +0100
parents 03c8e327f5ee
children 686285ab9602
files src/evalfunc.c src/testdir/test_cmdline.vim src/version.c
diffstat 3 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -2872,6 +2872,10 @@ get_function_name(expand_T *xp, int idx)
     }
     if (++intidx < (int)ARRAY_LENGTH(global_functions))
     {
+	// Skip if the function doesn't have an implementation (feature not
+	// implemented).
+	if (global_functions[intidx].f_func == NULL)
+	    return (char_u *)"";
 	STRCPY(IObuff, global_functions[intidx].f_name);
 	STRCAT(IObuff, "(");
 	if (global_functions[intidx].f_max_argc == 0)
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -489,6 +489,12 @@ func Test_getcompletion()
   let l = getcompletion('paint', 'function')
   call assert_equal([], l)
 
+  if !has('ruby')
+    " global_functions[] has an entry but it doesn't have an implemention
+    let l = getcompletion('ruby', 'function')
+    call assert_equal([], l)
+  endif
+
   let Flambda = {-> 'hello'}
   let l = getcompletion('', 'function')
   let l = filter(l, {i, v -> v =~ 'lambda'})
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1218,
+/**/
     1217,
 /**/
     1216,