Fix #272 by checking if quickfix is open before reopening to avoid triggering a BufEnter event that causes quickly repeating linting runs when g:ale_lint_on_enter = 1.
Add test assertions that quickfix window closes when lists become empty again.
This commit is contained in:
parent
a5ac3e4e4b
commit
b3f6f56745
@ -36,11 +36,13 @@ function! ale#list#SetLists(buffer, loclist) abort
|
|||||||
if len(a:loclist) > 0 || g:ale_keep_list_window_open
|
if len(a:loclist) > 0 || g:ale_keep_list_window_open
|
||||||
let l:winnr = winnr()
|
let l:winnr = winnr()
|
||||||
|
|
||||||
|
if !ale#list#IsQuickfixOpen()
|
||||||
if g:ale_set_quickfix
|
if g:ale_set_quickfix
|
||||||
copen
|
copen
|
||||||
elseif g:ale_set_loclist
|
elseif g:ale_set_loclist
|
||||||
lopen
|
lopen
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
" If focus changed, restore it (jump to the last window).
|
" If focus changed, restore it (jump to the last window).
|
||||||
if l:winnr !=# winnr()
|
if l:winnr !=# winnr()
|
||||||
|
@ -49,6 +49,10 @@ Execute(The quickfix window should open for just the loclist):
|
|||||||
call ale#list#SetLists(bufnr('%'), g:loclist)
|
call ale#list#SetLists(bufnr('%'), g:loclist)
|
||||||
Assert ale#list#IsQuickfixOpen()
|
Assert ale#list#IsQuickfixOpen()
|
||||||
|
|
||||||
|
" Clear the list and it should close again.
|
||||||
|
call ale#list#SetLists(bufnr('%'), [])
|
||||||
|
Assert !ale#list#IsQuickfixOpen()
|
||||||
|
|
||||||
Execute(The quickfix window should stay open for just the loclist):
|
Execute(The quickfix window should stay open for just the loclist):
|
||||||
let g:ale_open_list = 1
|
let g:ale_open_list = 1
|
||||||
let g:ale_keep_list_window_open = 1
|
let g:ale_keep_list_window_open = 1
|
||||||
@ -76,6 +80,10 @@ Execute(The quickfix window should open for the quickfix list):
|
|||||||
call ale#list#SetLists(bufnr('%'), g:loclist)
|
call ale#list#SetLists(bufnr('%'), g:loclist)
|
||||||
Assert ale#list#IsQuickfixOpen()
|
Assert ale#list#IsQuickfixOpen()
|
||||||
|
|
||||||
|
" Clear the list and it should close again.
|
||||||
|
call ale#list#SetLists(bufnr('%'), [])
|
||||||
|
Assert !ale#list#IsQuickfixOpen()
|
||||||
|
|
||||||
Execute(The quickfix window should stay open for the quickfix list):
|
Execute(The quickfix window should stay open for the quickfix list):
|
||||||
let g:ale_set_quickfix = 1
|
let g:ale_set_quickfix = 1
|
||||||
let g:ale_open_list = 1
|
let g:ale_open_list = 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user