diff options
author | w0rp <devw0rp@gmail.com> | 2017-02-21 12:46:07 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-02-21 12:46:07 +0000 |
commit | c310080359189b6b880a7e37170263a427026bc4 (patch) | |
tree | 45f45745ac62a67ea545be7ddd5d97ed6436eb68 /autoload | |
parent | 1a9c8b8d06d4b2b188b667148b26426ccf29e559 (diff) | |
download | ale-c310080359189b6b880a7e37170263a427026bc4.zip |
#314 filter both lists, and add tests to cover the list retrieval
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/loclist_jumping.vim | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/autoload/ale/loclist_jumping.vim b/autoload/ale/loclist_jumping.vim index b4d1993f..2531cdbc 100644 --- a/autoload/ale/loclist_jumping.vim +++ b/autoload/ale/loclist_jumping.vim @@ -2,19 +2,20 @@ " Description: This file implements functions for jumping around in a file " based on errors and warnings in the loclist or quickfix list. -function! s:GetCurrentList() abort +function! s:GetCurrentList() abort + let l:buffer = bufnr('%') + let l:list = [] + if g:ale_set_loclist - return getloclist(winnr()) + let l:list = getloclist(winnr()) elseif g:ale_set_quickfix - let l:buffer = bufnr('%') - - return filter(getqflist(), 'get(v:val, ''bufnr'', -1) == ' . l:buffer) + let l:list = getqflist() endif - return [] + return filter(l:list, 'get(v:val, ''bufnr'', -1) == ' . l:buffer) endfunction -function! s:GetSortedLoclist() abort +function! ale#loclist_jumping#GetSortedList() abort let l:loclist = [] for l:item in s:GetCurrentList() @@ -41,7 +42,7 @@ endfunction " List will be returned, otherwise a pair of [line_number, column_number] will " be returned. function! ale#loclist_jumping#FindNearest(direction, wrap) abort - let l:loclist = s:GetSortedLoclist() + let l:loclist = ale#loclist_jumping#GetSortedList() if empty(l:loclist) " We couldn't find anything, so stop here. |