diff options
-rw-r--r-- | autoload/ale/loclist_jumping.vim | 6 | ||||
-rw-r--r-- | test/test_loclist_jumping_loading.vader | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/autoload/ale/loclist_jumping.vim b/autoload/ale/loclist_jumping.vim index 2531cdbc..94a83e6c 100644 --- a/autoload/ale/loclist_jumping.vim +++ b/autoload/ale/loclist_jumping.vim @@ -6,10 +6,10 @@ function! s:GetCurrentList() abort let l:buffer = bufnr('%') let l:list = [] - if g:ale_set_loclist - let l:list = getloclist(winnr()) - elseif g:ale_set_quickfix + if g:ale_set_quickfix let l:list = getqflist() + elseif g:ale_set_loclist + let l:list = getloclist(winnr()) endif return filter(l:list, 'get(v:val, ''bufnr'', -1) == ' . l:buffer) diff --git a/test/test_loclist_jumping_loading.vader b/test/test_loclist_jumping_loading.vader index 06ae3742..fe43ef2f 100644 --- a/test/test_loclist_jumping_loading.vader +++ b/test/test_loclist_jumping_loading.vader @@ -72,3 +72,15 @@ Execute(An empty List should be returned when both lists are turned off): call setloclist(winnr(), [{'lnum': 1, 'col': 1, 'text': 'foo', 'bufnr': bufnr('%')}]) AssertEqual [], GetList() + +Execute(quickfix should take precedence over loclist when on): + let g:ale_set_quickfix = 1 + + call setloclist(winnr(), [ + \ {'lnum': 1, 'col': 1, 'text': 'ignore this', 'bufnr': g:buffer} + \]) + call setqflist([ + \ {'lnum': 1, 'col': 1, 'text': 'foo', 'bufnr': g:buffer}, + \]) + + AssertEqual [{'lnum': 1, 'col': 1, 'text': 'foo'}], GetList() |