diff options
author | w0rp <devw0rp@gmail.com> | 2017-11-19 23:09:20 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-11-21 14:57:28 +0000 |
commit | 5556fcbd1c271001d22b88a9d4533b3d64e0e394 (patch) | |
tree | 925a31032222f6e80c3d92802201cd3d872e4559 | |
parent | cf599f4470a7421b01dfd01976274f244894d7e1 (diff) | |
download | ale-5556fcbd1c271001d22b88a9d4533b3d64e0e394.zip |
Stop the completion tests from failing randomlyv1.6.2
-rw-r--r-- | autoload/ale/completion.vim | 13 | ||||
-rw-r--r-- | test/test_completion.vader | 4 |
2 files changed, 14 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 diff --git a/test/test_completion.vader b/test/test_completion.vader index 18e50f5b..3dfc2056 100644 --- a/test/test_completion.vader +++ b/test/test_completion.vader @@ -41,6 +41,10 @@ After: delfunction CheckCompletionCalled + " Stop any timers we left behind. + " This stops the tests from failing randomly. + call ale#completion#StopTimer() + runtime autoload/ale/completion.vim runtime autoload/ale/lsp.vim |