Fix #1041 - Do not request completions shortly after CompleteDone

This commit is contained in:
w0rp
2017-10-26 23:18:12 +01:00
parent 33c2c20e66
commit 6490d3a5e6
2 changed files with 34 additions and 12 deletions

View File

@@ -283,6 +283,13 @@ function! s:TimerHandler(...) abort
endfunction
function! ale#completion#Queue() abort
let l:time = get(b:, 'ale_complete_done_time', 0)
if l:time && ale#util#ClockMilliseconds() - l:time < 100
" Do not ask for completions shortly after we just closed the menu.
return
endif
let s:timer_pos = getcurpos()[1:2]
" If we changed the text again while we're still waiting for a response,
@@ -311,6 +318,9 @@ function! ale#completion#Done() abort
let &l:completeopt = b:ale_old_completopt
unlet b:ale_old_completopt
endif
" Set a timestamp, so we can avoid requesting completions again.
let b:ale_complete_done_time = ale#util#ClockMilliseconds()
endfunction
function! s:Setup(enabled) abort