Close #2285 - Add a function for use with omnifunc

This commit is contained in:
w0rp
2019-05-17 00:57:52 +01:00
parent 8cb6d043b4
commit e5ea809094
5 changed files with 135 additions and 9 deletions

View File

@@ -139,7 +139,7 @@ Execute(ale#completion#Show() should remember the omnifunc setting and replace i
call ale#completion#Show('Response', 'Parser')
AssertEqual 'FooBar', b:ale_old_omnifunc
AssertEqual 'ale#completion#OmniFunc', &l:omnifunc
AssertEqual 'ale#completion#AutomaticOmniFunc', &l:omnifunc
AssertEqual [], g:feedkeys_calls
sleep 1ms
@@ -184,20 +184,20 @@ Execute(ale#completion#Show() should not replace the completeopt setting for man
sleep 1ms
AssertEqual [["\<Plug>(ale_show_completion_menu)"]], g:feedkeys_calls
Execute(ale#completion#OmniFunc() should also remember the completeopt setting and replace it):
Execute(ale#completion#AutomaticOmniFunc() should also remember the completeopt setting and replace it):
let &l:completeopt = 'menu'
let b:ale_completion_info = {'source': 'ale-automatic'}
call ale#completion#OmniFunc(0, '')
call ale#completion#AutomaticOmniFunc(0, '')
AssertEqual 'menu', b:ale_old_completeopt
AssertEqual 'menu,menuone,noselect,noinsert', &l:completeopt
Execute(ale#completion#OmniFunc() should set the preview option if it's set):
Execute(ale#completion#AutomaticOmniFunc() should set the preview option if it's set):
let &l:completeopt = 'menu,preview'
let b:ale_completion_info = {'source': 'ale-automatic'}
call ale#completion#OmniFunc(0, '')
call ale#completion#AutomaticOmniFunc(0, '')
AssertEqual 'menu,preview', b:ale_old_completeopt
AssertEqual 'menu,menuone,preview,noselect,noinsert', &l:completeopt
@@ -317,6 +317,8 @@ Execute(b:ale_completion_info should be set up correctly when requesting complet
Execute(b:ale_completion_info should be set up correctly for other sources):
let b:ale_completion_result = []
let b:ale_completion_response = []
let b:ale_completion_parser = 'type'
call setpos('.', [bufnr(''), 3, 14, 0])
call ale#completion#GetCompletions('deoplete')
@@ -332,6 +334,8 @@ Execute(b:ale_completion_info should be set up correctly for other sources):
\ },
\ b:ale_completion_info
Assert !exists('b:ale_completion_result')
Assert !exists('b:ale_completion_response')
Assert !exists('b:ale_completion_parser')
Execute(The correct keybinds should be configured):
redir => g:output