]> granicus.if.org Git - vim/commitdiff
patch 9.0.1218: completion includes functions that don't work v9.0.1218
authorKota Kato <github@kat0h.com>
Wed, 18 Jan 2023 15:27:38 +0000 (15:27 +0000)
committerBram Moolenaar <Bram@vim.org>
Wed, 18 Jan 2023 15:27:38 +0000 (15:27 +0000)
Problem:    Completion includes functions that don't work.
Solution:   Skip functions that are not implemented. (Kota Kato,
            closes #11845)

src/evalfunc.c
src/testdir/test_cmdline.vim
src/version.c

index 923a75024a8c814fdc990c6012dafc41fc00d6ac..5b25e97cbe52be7e49d7ff41f1a2f9c5d90fac3c 100644 (file)
@@ -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)
index a8323062084170f37ca2a0e98b5c773723e6f697..9eca9186fa9b265a45841ff07975207be5dd5fc6 100644 (file)
@@ -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'})
index 4c7d8962cb65db119f91f150ec9a92738fdd7aaf..1cac4b5723c8159aeaae8ca3208c3d08bc5d15cc 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1218,
 /**/
     1217,
 /**/