mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-16 01:07:06 +08:00
Add option to open loclist/quicklist when there are errors (#266)
* Add option to open loclist/quicklist when there are errors I copied PR #137, and tries to complete it by correcting some issues and adding vader tests. About tests, first time with vader, can you give some feedback if there are what you expected in PR #137. * Remove old code + fix indent issue * add g:ale_keep_list_window_open option * Correct bug with keep open option * Add comment into vader file * Fix errors for Travis CI build
This commit is contained in:
96
test/test_loclist_quicklist.vader
Normal file
96
test/test_loclist_quicklist.vader
Normal file
@@ -0,0 +1,96 @@
|
||||
" Author: Yann Fery <yann@fery.me>
|
||||
|
||||
Before:
|
||||
let g:loclist = [
|
||||
\ {'lnum': 5, 'col': 5},
|
||||
\ {'lnum': 5, 'col': 4},
|
||||
\ {'lnum': 2, 'col': 10},
|
||||
\ {'lnum': 3, 'col': 2},
|
||||
\]
|
||||
let g:empty_loclist = []
|
||||
|
||||
After:
|
||||
" Close quickfix window after every execute block
|
||||
lcl
|
||||
ccl
|
||||
unlet g:loclist
|
||||
unlet g:empty_loclist
|
||||
|
||||
Execute (IsQuickfixOpen):
|
||||
AssertEqual 0, ale#list#IsQuickfixOpen()
|
||||
call setloclist(0, g:loclist)
|
||||
lopen
|
||||
AssertEqual 1, ale#list#IsQuickfixOpen()
|
||||
lcl
|
||||
AssertEqual 0, ale#list#IsQuickfixOpen()
|
||||
call setqflist(g:loclist)
|
||||
copen
|
||||
AssertEqual 1, ale#list#IsQuickfixOpen()
|
||||
ccl
|
||||
AssertEqual 0, ale#list#IsQuickfixOpen()
|
||||
|
||||
Execute (loclist and openlist):
|
||||
let g:ale_set_loclist = 1
|
||||
let g:ale_set_quickfix = 0
|
||||
let g:ale_open_list = 1
|
||||
let g:ale_keep_list_window_open = 0
|
||||
" With empty loclist, window must stay close
|
||||
call ale#list#SetLists(g:empty_loclist)
|
||||
AssertEqual 0, ale#list#IsQuickfixOpen()
|
||||
" With a loclist it must open
|
||||
call ale#list#SetLists(g:loclist)
|
||||
AssertEqual 1, ale#list#IsQuickfixOpen()
|
||||
" And with keep open option, must stay open even with empty loclist
|
||||
let g:ale_keep_list_window_open = 1
|
||||
call ale#list#SetLists(g:empty_loclist)
|
||||
AssertEqual 1, ale#list#IsQuickfixOpen()
|
||||
|
||||
Execute (loclist without openlist):
|
||||
let g:ale_set_loclist = 1
|
||||
let g:ale_set_quickfix = 0
|
||||
let g:ale_open_list = 0
|
||||
" Must stay close without loclist
|
||||
let g:ale_keep_list_window_open = 0
|
||||
call ale#list#SetLists(g:empty_loclist)
|
||||
AssertEqual 0, ale#list#IsQuickfixOpen()
|
||||
call ale#list#SetLists(g:loclist)
|
||||
AssertEqual 0, ale#list#IsQuickfixOpen()
|
||||
" Must stay open event without loclist
|
||||
let g:ale_keep_list_window_open = 1
|
||||
call ale#list#SetLists(g:empty_loclist)
|
||||
AssertEqual 1, ale#list#IsQuickfixOpen()
|
||||
call ale#list#SetLists(g:loclist)
|
||||
AssertEqual 1, ale#list#IsQuickfixOpen()
|
||||
|
||||
Execute (quickfix and openlist):
|
||||
let g:ale_set_loclist = 0
|
||||
let g:ale_set_quickfix = 1
|
||||
let g:ale_open_list = 1
|
||||
let g:ale_keep_list_window_open = 0
|
||||
" With empty loclist, window must stay close
|
||||
call ale#list#SetLists(g:empty_loclist)
|
||||
AssertEqual 0, ale#list#IsQuickfixOpen()
|
||||
" With a loclist it must open
|
||||
call ale#list#SetLists(g:loclist)
|
||||
AssertEqual 1, ale#list#IsQuickfixOpen()
|
||||
" And with keep open option, must stay open even with empty loclist
|
||||
let g:ale_keep_list_window_open = 1
|
||||
call ale#list#SetLists(g:empty_loclist)
|
||||
AssertEqual 1, ale#list#IsQuickfixOpen()
|
||||
|
||||
Execute (quickfix without openlist):
|
||||
let g:ale_set_loclist = 0
|
||||
let g:ale_set_quickfix = 1
|
||||
let g:ale_open_list = 0
|
||||
" Must stay close without loclist
|
||||
let g:ale_keep_list_window_open = 0
|
||||
call ale#list#SetLists(g:empty_loclist)
|
||||
AssertEqual 0, ale#list#IsQuickfixOpen()
|
||||
call ale#list#SetLists(g:loclist)
|
||||
AssertEqual 0, ale#list#IsQuickfixOpen()
|
||||
" Must stay open event without loclist
|
||||
let g:ale_keep_list_window_open = 1
|
||||
call ale#list#SetLists(g:empty_loclist)
|
||||
AssertEqual 1, ale#list#IsQuickfixOpen()
|
||||
call ale#list#SetLists(g:loclist)
|
||||
AssertEqual 1, ale#list#IsQuickfixOpen()
|
||||
Reference in New Issue
Block a user