mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-09 04:52:29 +08:00
Fix #2535 - Automatically emit <C-x><C-o> less to prevent <C-o> issues
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -69,8 +69,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_complete_done_time
|
||||
unlet! b:ale_linters
|
||||
unlet! b:ale_tsserver_completion_names
|
||||
@@ -246,14 +244,14 @@ Execute(Two completion requests shouldn't be sent in a row):
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'foo',
|
||||
\ 'command': 'foo',
|
||||
\ 'project_root_callback': {-> '/foo/bar'},
|
||||
\ 'project_root': {-> '/foo/bar'},
|
||||
\})
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'bar',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'foo',
|
||||
\ 'command': 'foo',
|
||||
\ 'project_root_callback': {-> '/foo/bar'},
|
||||
\ 'project_root': {-> '/foo/bar'},
|
||||
\})
|
||||
let b:ale_linters = ['foo', 'bar']
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
Before:
|
||||
unlet! b:ale_completion_info
|
||||
unlet! b:ale_completion_response
|
||||
unlet! b:ale_completion_parser
|
||||
unlet! b:ale_completion_result
|
||||
|
||||
let b:lsp_started = 0
|
||||
@@ -12,27 +10,19 @@ Before:
|
||||
return b:lsp_started
|
||||
endfunction
|
||||
|
||||
function! Identity(x) abort
|
||||
return a:x
|
||||
endfunction
|
||||
|
||||
function! SetCompletionResult(...) abort
|
||||
let b:ale_completion_result = ['foo']
|
||||
endfunction
|
||||
|
||||
function! SetCompletionResponse(...) abort
|
||||
let b:ale_completion_response = ['foo']
|
||||
let b:ale_completion_parser = 'Identity'
|
||||
let b:ale_completion_result = ['foo']
|
||||
endfunction
|
||||
|
||||
After:
|
||||
unlet! b:ale_completion_info
|
||||
unlet! b:ale_completion_response
|
||||
unlet! b:ale_completion_parser
|
||||
unlet! b:ale_completion_result
|
||||
unlet! b:lsp_started
|
||||
|
||||
delfunction Identity
|
||||
delfunction SetCompletionResult
|
||||
delfunction SetCompletionResponse
|
||||
|
||||
|
||||
@@ -3,42 +3,21 @@ Before:
|
||||
|
||||
unlet! b:ale_linters
|
||||
unlet! b:ale_completion_info
|
||||
unlet! b:ale_completion_response
|
||||
unlet! b:ale_completion_parser
|
||||
unlet! b:ale_completion_result
|
||||
|
||||
function! Identity(x) abort
|
||||
return a:x
|
||||
endfunction
|
||||
|
||||
After:
|
||||
delfunction Identity
|
||||
|
||||
call ale#linter#Reset()
|
||||
|
||||
unlet! b:ale_linters
|
||||
unlet! b:ale_completion_info
|
||||
unlet! b:ale_completion_response
|
||||
unlet! b:ale_completion_parser
|
||||
unlet! b:ale_completion_result
|
||||
|
||||
Execute(ale#completion#GetCompletionResult() should return v:null when there are no results):
|
||||
AssertEqual v:null, ale#completion#GetCompletionResult()
|
||||
|
||||
Execute(ale#completion#GetCompletionResult() should parse the result when it has yet to be parsed):
|
||||
let b:ale_completion_response = [1]
|
||||
let b:ale_completion_parser = 'Identity'
|
||||
|
||||
AssertEqual [1], ale#completion#GetCompletionResult()
|
||||
Assert !exists('b:ale_completion_response')
|
||||
Assert !exists('b:ale_completion_parser')
|
||||
AssertEqual [1], b:ale_completion_result
|
||||
|
||||
Execute(ale#completion#GetCompletionResult() should return a result computed previously):
|
||||
let b:ale_completion_result = [1]
|
||||
|
||||
Assert !exists('b:ale_completion_response')
|
||||
Assert !exists('b:ale_completion_parser')
|
||||
AssertEqual [1], ale#completion#GetCompletionResult()
|
||||
|
||||
Execute(ale#completion#GetCompletionPosition() should return 0 when there is no completion information):
|
||||
|
||||
Reference in New Issue
Block a user