]> granicus.if.org Git - vim/commitdiff
patch 9.0.0092: plugins cannot change v:completed_item v9.0.0092
authorShougo Matsushita <Shougo.Matsu@gmail.com>
Wed, 27 Jul 2022 13:40:00 +0000 (14:40 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 27 Jul 2022 13:40:00 +0000 (14:40 +0100)
Problem:    Plugins cannot change v:completed_item.
Solution:   Make v:completed_item writeable. (Shougo Matsushita,
            closes #10801)

runtime/doc/eval.txt
src/evalvars.c
src/testdir/test_ins_complete.vim
src/version.c

index 290f03ff2445dd3bd3d3b9326df66ea8825e36e5..3dfacf72919ebefc11b61fa9456d63bced130200 100644 (file)
@@ -2005,6 +2005,8 @@ v:completed_item
                |Dictionary| containing the |complete-items| for the most
                recently completed word after |CompleteDone|.  The
                |Dictionary| is empty if the completion failed.
+               Note: Plugins can modify the value to emulate the builtin
+               |CompleteDone| event behavior.
 
                                        *v:count* *count-variable*
 v:count                The count given for the last Normal mode command.  Can be used
index 7e6bf7a92e12bae4d237c631b0bcaf335758fcbb..16dfd0d12674abf1016783d996fc4f726ed05b18 100644 (file)
@@ -111,7 +111,7 @@ static struct vimvar
     {VV_NAME("oldfiles",        VAR_LIST), &t_list_string, 0},
     {VV_NAME("windowid",        VAR_NUMBER), NULL, VV_RO},
     {VV_NAME("progpath",        VAR_STRING), NULL, VV_RO},
-    {VV_NAME("completed_item",  VAR_DICT), &t_dict_string, VV_RO},
+    {VV_NAME("completed_item",  VAR_DICT), &t_dict_string, 0},
     {VV_NAME("option_new",      VAR_STRING), NULL, VV_RO},
     {VV_NAME("option_old",      VAR_STRING), NULL, VV_RO},
     {VV_NAME("option_oldlocal",         VAR_STRING), NULL, VV_RO},
index 7bebc5d8a996d0dcd2f7bfceb10e012f717bd14c..35c5785d3a099ec0ff3be1ac8bcae024e5301431 100644 (file)
@@ -387,6 +387,19 @@ func Test_CompleteDone_undo()
   au! CompleteDone
 endfunc
 
+func Test_CompleteDone_modify()
+  let value = {
+        \ 'word': '',
+        \ 'abbr': '',
+        \ 'menu': '',
+        \ 'info': '',
+        \ 'kind': '',
+        \ 'user_data': '',
+        \ }
+  let v:completed_item = value
+  call assert_equal(v:completed_item, value)
+endfunc
+
 func CompleteTest(findstart, query)
   if a:findstart
     return col('.')
index 5adb215d1023df9d71298e88b33288e027c50cb2..4d97dcddaab41bd17cfa976ee528fa8659295a72 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    92,
 /**/
     91,
 /**/