Change the completeopt setting just before showing suggestions too, which works better
This commit is contained in:
parent
41c4f3431c
commit
8cc7cd3aa1
@ -71,6 +71,14 @@ function! ale#completion#FilterSuggestionsByPrefix(suggestions, prefix) abort
|
|||||||
return l:filtered_suggestions
|
return l:filtered_suggestions
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:ReplaceCompleteopt() abort
|
||||||
|
if !exists('b:ale_old_completopt')
|
||||||
|
let b:ale_old_completopt = &l:completeopt
|
||||||
|
endif
|
||||||
|
|
||||||
|
let &l:completeopt = 'menu,menuone,preview,noselect,noinsert'
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale#completion#OmniFunc(findstart, base) abort
|
function! ale#completion#OmniFunc(findstart, base) abort
|
||||||
if a:findstart
|
if a:findstart
|
||||||
let l:line = b:ale_completion_info.line
|
let l:line = b:ale_completion_info.line
|
||||||
@ -98,6 +106,8 @@ function! ale#completion#OmniFunc(findstart, base) abort
|
|||||||
\)[: g:ale_completion_max_suggestions]
|
\)[: g:ale_completion_max_suggestions]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call s:ReplaceCompleteopt()
|
||||||
|
|
||||||
return get(b:, 'ale_completion_result', [])
|
return get(b:, 'ale_completion_result', [])
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -115,16 +125,12 @@ function! ale#completion#Show(response, completion_parser) abort
|
|||||||
let b:ale_old_omnifunc = &l:omnifunc
|
let b:ale_old_omnifunc = &l:omnifunc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists('b:ale_old_completopt')
|
|
||||||
let b:ale_old_completopt = &l:completeopt
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Set the list in the buffer, temporarily replace omnifunc with our
|
" Set the list in the buffer, temporarily replace omnifunc with our
|
||||||
" function, and then start omni-completion.
|
" function, and then start omni-completion.
|
||||||
let b:ale_completion_response = a:response
|
let b:ale_completion_response = a:response
|
||||||
let b:ale_completion_parser = a:completion_parser
|
let b:ale_completion_parser = a:completion_parser
|
||||||
let &l:omnifunc = 'ale#completion#OmniFunc'
|
let &l:omnifunc = 'ale#completion#OmniFunc'
|
||||||
let &l:completeopt = 'menu,menuone,preview,noselect,noinsert'
|
call s:ReplaceCompleteopt()
|
||||||
call ale#completion#FeedKeys("\<C-x>\<C-o>", 'n')
|
call ale#completion#FeedKeys("\<C-x>\<C-o>", 'n')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -141,6 +141,14 @@ Execute(ale#completion#Show() should remember the completeopt setting and replac
|
|||||||
AssertEqual 'menu', b:ale_old_completopt
|
AssertEqual 'menu', b:ale_old_completopt
|
||||||
AssertEqual 'menu,menuone,preview,noselect,noinsert', &l:completeopt
|
AssertEqual 'menu,menuone,preview,noselect,noinsert', &l:completeopt
|
||||||
|
|
||||||
|
Execute(ale#completion#OmniFunc() should also remember the completeopt setting and replace it):
|
||||||
|
let &l:completeopt = 'menu'
|
||||||
|
|
||||||
|
call ale#completion#OmniFunc(0, '')
|
||||||
|
|
||||||
|
AssertEqual 'menu', b:ale_old_completopt
|
||||||
|
AssertEqual 'menu,menuone,preview,noselect,noinsert', &l:completeopt
|
||||||
|
|
||||||
Execute(ale#completion#Show() should make the correct feedkeys() call):
|
Execute(ale#completion#Show() should make the correct feedkeys() call):
|
||||||
call ale#completion#Show('Response', 'Parser')
|
call ale#completion#Show('Response', 'Parser')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user