diff options
author | w0rp <devw0rp@gmail.com> | 2017-09-08 20:10:00 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-09-08 20:11:28 +0100 |
commit | b8dcdc984bfb1e8cc1adbb77c47c650db2d3caf0 (patch) | |
tree | 3840d0641d121593cb947b40851e65ef696c5e77 | |
parent | c6d3d646ac61b3cca4d0e29ac25bc344835668cb (diff) | |
download | ale-1.5.1.zip |
Fix #912 - Close lists automatically when g:ale_open_list is set to 'on_save' againv1.5.1
-rw-r--r-- | autoload/ale/list.vim | 8 | ||||
-rw-r--r-- | test/test_list_opening.vader | 7 |
2 files changed, 14 insertions, 1 deletions
diff --git a/autoload/ale/list.vim b/autoload/ale/list.vim index fd8b62ef..bc8d4115 100644 --- a/autoload/ale/list.vim +++ b/autoload/ale/list.vim @@ -123,13 +123,19 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort " If ALE isn't currently checking for more problems, close the window if " needed now. This check happens inside of this timer function, so " the window can be closed reliably. - if !ale#engine#IsCheckingBuffer(bufnr('')) + if !ale#engine#IsCheckingBuffer(a:buffer) call s:CloseWindowIfNeeded(a:buffer) endif endfunction function! ale#list#SetLists(buffer, loclist) abort if get(g:, 'ale_set_lists_synchronously') == 1 + \|| getbufvar(a:buffer, 'ale_save_event_fired', 0) + " Update lists immediately if running a test synchronously, or if the + " buffer was saved. + " + " The lists need to be updated immediately when saving a buffer so + " that we can reliably close window automatically, if so configured. call s:SetListsImpl(-1, a:buffer, a:loclist) else call ale#util#StartPartialTimer( diff --git a/test/test_list_opening.vader b/test/test_list_opening.vader index 7dc5a79b..63b30ef1 100644 --- a/test/test_list_opening.vader +++ b/test/test_list_opening.vader @@ -189,12 +189,19 @@ Execute(The ale_open_list='on_save' option should work): " The list shouldn't open yet, the event wasn't fired. Assert !ale#list#IsQuickfixOpen() + " Turn this option off, to ensure that we update lists immediately when we + " save buffers. + let g:ale_set_lists_synchronously = 0 let b:ale_save_event_fired = 1 call ale#list#SetLists(bufnr('%'), g:loclist) " Now the list should have opened. Assert ale#list#IsQuickfixOpen() + call ale#list#SetLists(bufnr('%'), []) + " The window should close again when the loclist is empty. + Assert !ale#list#IsQuickfixOpen() + Execute(The window shouldn't open on save when ale_open_list=0): let b:ale_open_list = 0 let b:ale_save_event_fired = 1 |