Fix #2535 - Automatically emit <C-x><C-o> less to prevent <C-o> issues

This commit is contained in:
w0rp
2019-05-28 20:03:35 +01:00
parent bc0abc3b96
commit 67d7caee30
5 changed files with 29 additions and 77 deletions

View File

@@ -57,8 +57,6 @@ After:
unlet! b:ale_old_omnifunc
unlet! b:ale_old_completeopt
unlet! b:ale_completion_info
unlet! b:ale_completion_response
unlet! b:ale_completion_parser
unlet! b:ale_completion_result
unlet! b:ale_complete_done_time
@@ -136,7 +134,7 @@ Execute(ale#completion#Show() should remember the omnifunc setting and replace i
let &l:omnifunc = 'FooBar'
let b:ale_completion_info = {'source': 'ale-automatic'}
call ale#completion#Show('Response', 'Parser')
call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}])
AssertEqual 'FooBar', b:ale_old_omnifunc
AssertEqual 'ale#completion#AutomaticOmniFunc', &l:omnifunc
@@ -149,7 +147,7 @@ Execute(ale#completion#Show() should remember the completeopt setting and replac
let &l:completeopt = 'menu'
let b:ale_completion_info = {'source': 'ale-automatic'}
call ale#completion#Show('Response', 'Parser')
call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}])
AssertEqual 'menu', b:ale_old_completeopt
AssertEqual 'menu,menuone,noselect,noinsert', &l:completeopt
@@ -162,7 +160,7 @@ Execute(ale#completion#Show() 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#Show('Response', 'Parser')
call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}])
AssertEqual 'menu,preview', b:ale_old_completeopt
AssertEqual 'menu,menuone,preview,noselect,noinsert', &l:completeopt
@@ -176,7 +174,7 @@ Execute(ale#completion#Show() should not replace the completeopt setting for man
let &l:completeopt = 'menu,preview'
call ale#completion#Show('Response', 'Parser')
call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}])
Assert !exists('b:ale_old_completeopt')
@@ -204,7 +202,7 @@ Execute(ale#completion#AutomaticOmniFunc() should set the preview option if it's
Execute(ale#completion#Show() should make the correct feedkeys() call for automatic completion):
let b:ale_completion_info = {'source': 'ale-automatic'}
call ale#completion#Show('Response', 'Parser')
call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}])
AssertEqual [], g:feedkeys_calls
sleep 1ms
@@ -212,7 +210,7 @@ Execute(ale#completion#Show() should make the correct feedkeys() call for automa
Execute(ale#completion#Show() should make the correct feedkeys() call for manual completion):
let b:ale_completion_info = {'source': 'ale-automatic'}
call ale#completion#Show('Response', 'Parser')
call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}])
AssertEqual [], g:feedkeys_calls
sleep 1ms
@@ -220,7 +218,7 @@ Execute(ale#completion#Show() should make the correct feedkeys() call for manual
Execute(ale#completion#Show() should not call feedkeys() for other sources):
let b:ale_completion_info = {'source': 'deoplete'}
call ale#completion#Show('Response', 'Parser')
call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}])
sleep 1ms
AssertEqual [], g:feedkeys_calls
@@ -229,20 +227,22 @@ Execute(ale#completion#Show() shouldn't do anything if you switch back to normal
let &l:completeopt = 'menu,preview'
let g:fake_mode = 'n'
call ale#completion#Show('Response', 'Parser')
call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}])
AssertEqual 'menu,preview', &l:completeopt
Assert !exists('b:ale_old_omnifunc')
Assert !exists('b:ale_old_completeopt')
Assert !exists('b:ale_completion_response')
Assert !exists('b:ale_completion_parser')
Assert !exists('b:ale_completion_result')
AssertEqual [], g:feedkeys_calls
Execute(ale#completion#Show() should set up the response and parser):
call ale#completion#Show('Response', 'Parser')
Execute(ale#completion#Show() should save the result it is given):
call ale#completion#Show([])
AssertEqual 'Response', b:ale_completion_response
AssertEqual 'Parser', b:ale_completion_parser
AssertEqual [], b:ale_completion_result
call ale#completion#Show([{'word': 'x', 'kind': 'v', 'icase': 1}])
AssertEqual [{'word': 'x', 'kind': 'v', 'icase': 1}], b:ale_completion_result
Execute(ale#completion#Done() should restore old omnifunc values):
let b:ale_old_omnifunc = 'FooBar'
@@ -317,8 +317,6 @@ 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')
@@ -334,8 +332,6 @@ 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