mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
completion: Initialize v:completed_item #2839
v:completed_item should always be a dict (not empty string), even before the first completion.
This commit is contained in:

committed by
Justin M. Keyes

parent
7b87dc9299
commit
8b200f904f
@@ -503,6 +503,7 @@ void eval_init(void)
|
||||
/* add to compat scope dict */
|
||||
hash_add(&compat_hashtab, p->vv_di.di_key);
|
||||
}
|
||||
set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc());
|
||||
set_vim_var_nr(VV_SEARCHFORWARD, 1L);
|
||||
set_vim_var_nr(VV_HLSEARCH, 1L);
|
||||
set_reg_var(0); /* default for v:register is not 0 but '"' */
|
||||
|
@@ -10,6 +10,13 @@ describe('completion', function()
|
||||
end)
|
||||
|
||||
describe('v:completed_item', function()
|
||||
it('is empty dict until completion', function()
|
||||
eq({}, eval('v:completed_item'))
|
||||
end)
|
||||
it('is empty dict if the candidate is not inserted', function()
|
||||
feed('ifoo<ESC>o<C-x><C-n><C-e><ESC>')
|
||||
eq({}, eval('v:completed_item'))
|
||||
end)
|
||||
it('returns expected dict in normal completion', function()
|
||||
feed('ifoo<ESC>o<C-x><C-n><ESC>')
|
||||
eq('foo', eval('getline(2)'))
|
||||
|
Reference in New Issue
Block a user