summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-19 23:09:20 +0000
committerw0rp <devw0rp@gmail.com>2017-11-19 23:09:20 +0000
commit0cb8130d0e65d9a239c43ddb21d2f89b2815f10d (patch)
tree725ff05e04fc3bf4d524e566ff41cc66aef5bf2e /autoload
parentcc04a7aaa030de9e030728b86c0428de9cbb112c (diff)
downloadale-0cb8130d0e65d9a239c43ddb21d2f89b2815f10d.zip
Stop the completion tests from failing randomly
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/completion.vim13
1 files changed, 10 insertions, 3 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 90c9ae29..e471a3bd 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -282,6 +282,15 @@ function! s:TimerHandler(...) abort
endif
endfunction
+" Stop any completion timer that is queued. This is useful for tests.
+function! ale#completion#StopTimer() abort
+ if s:timer_id != -1
+ call timer_stop(s:timer_id)
+ endif
+
+ let s:timer_id = -1
+endfunction
+
function! ale#completion#Queue() abort
let l:time = get(b:, 'ale_complete_done_time', 0)
@@ -298,9 +307,7 @@ function! ale#completion#Queue() abort
let b:ale_completion_info.request_id = 0
endif
- if s:timer_id != -1
- call timer_stop(s:timer_id)
- endif
+ call ale#completion#StopTimer()
let s:timer_id = timer_start(g:ale_completion_delay, function('s:TimerHandler'))
endfunction