diff options
author | w0rp <devw0rp@gmail.com> | 2017-08-18 21:06:21 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-08-18 21:06:21 +0100 |
commit | 8cc7cd3aa14851f0c214c54b2c8affed448399ff (patch) | |
tree | 63d1d918e76593501a6dfc98dd8c0be4ac96f92d /autoload | |
parent | 41c4f3431c1a5ae2da8b0b859a92dbddc9fe7534 (diff) | |
download | ale-8cc7cd3aa14851f0c214c54b2c8affed448399ff.zip |
Change the completeopt setting just before showing suggestions too, which works better
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/completion.vim | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim index 07f755ea..3bcf3e9f 100644 --- a/autoload/ale/completion.vim +++ b/autoload/ale/completion.vim @@ -71,6 +71,14 @@ function! ale#completion#FilterSuggestionsByPrefix(suggestions, prefix) abort return l:filtered_suggestions 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 if a:findstart let l:line = b:ale_completion_info.line @@ -98,6 +106,8 @@ function! ale#completion#OmniFunc(findstart, base) abort \)[: g:ale_completion_max_suggestions] endif + call s:ReplaceCompleteopt() + return get(b:, 'ale_completion_result', []) endif endfunction @@ -115,16 +125,12 @@ function! ale#completion#Show(response, completion_parser) abort let b:ale_old_omnifunc = &l:omnifunc 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 " function, and then start omni-completion. let b:ale_completion_response = a:response let b:ale_completion_parser = a:completion_parser 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') endfunction |