mirror of
https://github.com/neovim/neovim.git
synced 2026-08-28 18:11:47 +00:00
vim-patch:8.0.1493: completion items cannot be annotated (#8003)
Problem: Completion items cannot be annotated.
Solution: Add a "user_data" entry to the completion item. (Ben Jackson,
coses vim/vim#2608, closes vim/vim#2508)
9b56a57cda
This commit is contained in:
@@ -59,7 +59,8 @@ describe('completion', function()
|
||||
it('returns expected dict in normal completion', function()
|
||||
feed('ifoo<ESC>o<C-x><C-n>')
|
||||
eq('foo', eval('getline(2)'))
|
||||
eq({word = 'foo', abbr = '', menu = '', info = '', kind = ''},
|
||||
eq({word = 'foo', abbr = '', menu = '',
|
||||
info = '', kind = '', user_data = ''},
|
||||
eval('v:completed_item'))
|
||||
end)
|
||||
it('is readonly', function()
|
||||
@@ -84,13 +85,18 @@ describe('completion', function()
|
||||
feed_command('let v:completed_item.kind = "bar"')
|
||||
neq(nil, string.find(eval('v:errmsg'), '^E46: '))
|
||||
feed_command('let v:errmsg = ""')
|
||||
|
||||
feed_command('let v:completed_item.user_data = "bar"')
|
||||
neq(nil, string.find(eval('v:errmsg'), '^E46: '))
|
||||
feed_command('let v:errmsg = ""')
|
||||
end)
|
||||
it('returns expected dict in omni completion', function()
|
||||
source([[
|
||||
function! TestOmni(findstart, base) abort
|
||||
return a:findstart ? 0 : [{'word': 'foo', 'abbr': 'bar',
|
||||
\ 'menu': 'baz', 'info': 'foobar', 'kind': 'foobaz'},
|
||||
\ {'word': 'word', 'abbr': 'abbr', 'menu': 'menu', 'info': 'info', 'kind': 'kind'}]
|
||||
\ {'word': 'word', 'abbr': 'abbr', 'menu': 'menu',
|
||||
\ 'info': 'info', 'kind': 'kind'}]
|
||||
endfunction
|
||||
setlocal omnifunc=TestOmni
|
||||
]])
|
||||
@@ -107,7 +113,7 @@ describe('completion', function()
|
||||
{3:-- Omni completion (^O^N^P) }{4:match 1 of 2} |
|
||||
]])
|
||||
eq({word = 'foo', abbr = 'bar', menu = 'baz',
|
||||
info = 'foobar', kind = 'foobaz'},
|
||||
info = 'foobar', kind = 'foobaz', user_data = ''},
|
||||
eval('v:completed_item'))
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user