#653 Collect items for quickfix from all buffers, and de-duplicate them. Set filename items in quickfix and loclist.

This commit is contained in:
w0rp
2017-08-19 14:28:51 +01:00
parent 9c6e25d8d8
commit 5c839c4825
7 changed files with 180 additions and 42 deletions

View File

@@ -0,0 +1,50 @@
Before:
Save g:ale_buffer_info
After:
Restore
Execute:
" Results from multiple buffers should be gathered together.
" Equal problems should be de-duplicated.
let g:ale_buffer_info = {
\ '1': {'loclist': [
\ {'bufnr': 2, 'lnum': 1, 'col': 2, 'text': 'foo'},
\ {'bufnr': 2, 'lnum': 1, 'col': 5, 'text': 'bar'},
\ {'bufnr': -1, 'filename': 'c', 'lnum': 3, 'col': 2, 'text': 'x'},
\ {'bufnr': 1, 'lnum': 5, 'col': 4, 'text': 'x'},
\ {'bufnr': 2, 'lnum': 5, 'col': 5, 'text': 'foo'},
\ {'bufnr': 1, 'lnum': 2, 'col': 10, 'text': 'x'},
\ {'bufnr': 1, 'lnum': 3, 'col': 2, 'text': 'x'},
\ {'bufnr': 1, 'lnum': 5, 'col': 5, 'text': 'x'},
\ {'bufnr': -1, 'filename': 'b', 'lnum': 4, 'col': 2, 'text': 'x'},
\ {'bufnr': -1, 'filename': 'b', 'lnum': 5, 'col': 2, 'text': 'x'},
\ {'bufnr': 3, 'lnum': 1, 'col': 1, 'text': 'foo'},
\ ]},
\ '2': {'loclist': [
\ {'bufnr': 1, 'lnum': 2, 'col': 10, 'text': 'x'},
\ {'bufnr': 1, 'lnum': 5, 'col': 5, 'text': 'x'},
\ {'bufnr': 2, 'lnum': 1, 'col': 2, 'text': 'foo'},
\ {'bufnr': 1, 'lnum': 3, 'col': 2, 'text': 'x'},
\ {'bufnr': 1, 'lnum': 5, 'col': 4, 'text': 'x'},
\ {'bufnr': 2, 'lnum': 1, 'col': 5, 'text': 'bar'},
\ {'bufnr': 2, 'lnum': 5, 'col': 5, 'text': 'another error'},
\ ]},
\}
AssertEqual
\ [
\ {'bufnr': -1, 'filename': 'b', 'lnum': 4, 'col': 2, 'text': 'x'},
\ {'bufnr': -1, 'filename': 'b', 'lnum': 5, 'col': 2, 'text': 'x'},
\ {'bufnr': -1, 'filename': 'c', 'lnum': 3, 'col': 2, 'text': 'x'},
\ {'bufnr': 1, 'lnum': 2, 'col': 10, 'text': 'x'},
\ {'bufnr': 1, 'lnum': 3, 'col': 2, 'text': 'x'},
\ {'bufnr': 1, 'lnum': 5, 'col': 4, 'text': 'x'},
\ {'bufnr': 1, 'lnum': 5, 'col': 5, 'text': 'x'},
\ {'bufnr': 2, 'lnum': 1, 'col': 2, 'text': 'foo'},
\ {'bufnr': 2, 'lnum': 1, 'col': 5, 'text': 'bar'},
\ {'bufnr': 2, 'lnum': 5, 'col': 5, 'text': 'another error'},
\ {'bufnr': 2, 'lnum': 5, 'col': 5, 'text': 'foo'},
\ {'bufnr': 3, 'lnum': 1, 'col': 1, 'text': 'foo'},
\ ],
\ ale#list#GetCombinedList()