Close #1690 - Respect the preview setting for completeopt

This commit is contained in:
w0rp 2018-07-04 08:52:08 +01:00
parent db85b931ec
commit ca7fa31c61
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
2 changed files with 23 additions and 2 deletions

View File

@ -134,7 +134,11 @@ function! s:ReplaceCompleteopt() abort
let b:ale_old_completopt = &l:completeopt let b:ale_old_completopt = &l:completeopt
endif endif
let &l:completeopt = 'menu,menuone,preview,noselect,noinsert' if &l:completeopt =~# 'preview'
let &l:completeopt = 'menu,menuone,preview,noselect,noinsert'
else
let &l:completeopt = 'menu,menuone,noselect,noinsert'
endif
endfunction endfunction
function! ale#completion#OmniFunc(findstart, base) abort function! ale#completion#OmniFunc(findstart, base) abort

View File

@ -9,6 +9,8 @@ Before:
let g:get_completions_called = 0 let g:get_completions_called = 0
let g:feedkeys_calls = [] let g:feedkeys_calls = []
let &l:completeopt = 'menu,menuone,preview,noselect,noinsert'
runtime autoload/ale/util.vim runtime autoload/ale/util.vim
function! ale#util#FeedKeys(string, mode) abort function! ale#util#FeedKeys(string, mode) abort
@ -95,6 +97,14 @@ Execute(ale#completion#Show() should remember the completeopt setting and replac
call ale#completion#Show('Response', 'Parser') call ale#completion#Show('Response', 'Parser')
AssertEqual 'menu', b:ale_old_completopt AssertEqual 'menu', b:ale_old_completopt
AssertEqual 'menu,menuone,noselect,noinsert', &l:completeopt
Execute(ale#completion#Show() should set the preview option if it's set):
let &l:completeopt = 'menu,preview'
call ale#completion#Show('Response', 'Parser')
AssertEqual 'menu,preview', 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): Execute(ale#completion#OmniFunc() should also remember the completeopt setting and replace it):
@ -103,6 +113,14 @@ Execute(ale#completion#OmniFunc() should also remember the completeopt setting a
call ale#completion#OmniFunc(0, '') call ale#completion#OmniFunc(0, '')
AssertEqual 'menu', b:ale_old_completopt AssertEqual 'menu', b:ale_old_completopt
AssertEqual 'menu,menuone,noselect,noinsert', &l:completeopt
Execute(ale#completion#OmniFunc() should set the preview option if it's set):
let &l:completeopt = 'menu,preview'
call ale#completion#OmniFunc(0, '')
AssertEqual 'menu,preview', b:ale_old_completopt
AssertEqual 'menu,menuone,preview,noselect,noinsert', &l:completeopt 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):
@ -127,7 +145,6 @@ Execute(ale#completion#Done() should restore old omnifunc values):
Execute(ale#completion#Done() should restore the old completeopt setting): Execute(ale#completion#Done() should restore the old completeopt setting):
let b:ale_old_completopt = 'menu' let b:ale_old_completopt = 'menu'
let &l:completeopt = 'menu,menuone,preview,noselect,noinsert'
call ale#completion#Done() call ale#completion#Done()