#653 Set problems from other buffers when buffers are first checked

This commit is contained in:
w0rp
2017-08-19 20:15:36 +01:00
parent b2d3764a18
commit 9d6883561c
4 changed files with 123 additions and 23 deletions

View File

@@ -21,6 +21,8 @@ function! ale#util#GetFunction(string_or_ref) abort
return a:string_or_ref
endfunction
" Compare two loclist items for ALE, sorted by their buffers, filenames, and
" line numbers and column numbers.
function! ale#util#LocItemCompare(left, right) abort
if a:left.bufnr < a:right.bufnr
return -1
@@ -59,6 +61,27 @@ function! ale#util#LocItemCompare(left, right) abort
return 0
endfunction
" Compare two loclist items, including the text for the items.
"
" This function can be used for de-duplicating lists.
function! ale#util#LocItemCompareWithText(left, right) abort
let l:cmp_value = ale#util#LocItemCompare(a:left, a:right)
if l:cmp_value
return l:cmp_value
endif
if a:left.text < a:right.text
return -1
endif
if a:left.text > a:right.text
return 1
endif
return 0
endfunction
" This function will perform a binary search and a small sequential search
" on the list to find the last problem in the buffer and line which is
" on or before the column. The index of the problem will be returned.