diff options
author | w0rp <devw0rp@gmail.com> | 2017-08-22 21:19:36 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-08-22 21:19:36 +0100 |
commit | 1a524ca63e51092ab10febea40a6f018b6e85173 (patch) | |
tree | 3d12ec01af3bfebd1bb59b7e6727f750f5641d8e /autoload/ale/list.vim | |
parent | 47a8ebc8b9ae76ee2b23e388d30324b97e102eed (diff) | |
download | ale-1a524ca63e51092ab10febea40a6f018b6e85173.zip |
#653 - Always set loclist or quickfix in a timer callback, which prevents errors E924, E925, and E926
Diffstat (limited to 'autoload/ale/list.vim')
-rw-r--r-- | autoload/ale/list.vim | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/autoload/ale/list.vim b/autoload/ale/list.vim index 25920ce6..7b2bf2cb 100644 --- a/autoload/ale/list.vim +++ b/autoload/ale/list.vim @@ -1,6 +1,10 @@ " Author: Bjorn Neergaard <bjorn@neersighted.com>, modified by Yann fery <yann@fery.me> " Description: Manages the loclist and quickfix lists +if !exists('s:timer_args') + let s:timer_args = {} +endif + " Return 1 if there is a buffer with buftype == 'quickfix' in bufffer list function! ale#list#IsQuickfixOpen() abort for l:buf in range(1, bufnr('$')) @@ -52,7 +56,7 @@ function! s:FixList(list) abort return l:new_list endfunction -function! ale#list#SetLists(buffer, loclist) abort +function! s:SetListsImpl(timer_id, buffer, loclist) abort let l:title = expand('#' . a:buffer . ':p') if g:ale_set_quickfix @@ -115,7 +119,19 @@ function! ale#list#SetLists(buffer, loclist) abort endif endfunction -function! ale#list#CloseWindowIfNeeded(buffer) abort +function! ale#list#SetLists(buffer, loclist) abort + if get(g:, 'ale_set_lists_synchronously') == 1 + call s:SetListsImpl(-1, a:buffer, a:loclist) + else + call ale#util#StartPartialTimer( + \ 0, + \ function('s:SetListsImpl'), + \ [a:buffer, a:loclist], + \) + endif +endfunction + +function! s:CloseWindowIfNeededImpl(timer_id, buffer) abort if ale#Var(a:buffer, 'keep_list_window_open') || !s:ShouldOpen(a:buffer) return endif @@ -134,3 +150,15 @@ function! ale#list#CloseWindowIfNeeded(buffer) abort catch /E444/ endtry endfunction + +function! ale#list#CloseWindowIfNeeded(buffer) abort + if get(g:, 'ale_set_lists_synchronously') == 1 + call s:CloseWindowIfNeededImpl(-1, a:buffer) + else + call ale#util#StartPartialTimer( + \ 0, + \ function('s:CloseWindowIfNeededImpl'), + \ [a:buffer], + \) + endif +endfunction |