mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-11 20:51:49 +08:00
#653 Set problems from other buffers when buffers are first checked
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user