1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
Before:
let g:buffer = bufnr('%')
function! GetList() abort
return map(
\ ale#loclist_jumping#GetSortedList(),
\ '{''lnum'': v:val.lnum, ''col'': v:val.col, ''text'': v:val.text}'
\)
endfunction
After:
unlet! g:buffer
unlet! g:new_buffer
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
call setloclist(winnr(), [])
call setqflist([])
delfunction GetList
Execute(The loclist should be filtered and sorted appropriately for jumping):
:new
let g:new_buffer = bufnr('%')
AssertNotEqual g:new_buffer, g:buffer
call setloclist(winnr(), [
\ {'lnum': 1, 'col': 1, 'text': 'ignore this', 'bufnr': g:buffer},
\ {'lnum': 20, 'col': 5, 'text': 'baz', 'bufnr': g:new_buffer},
\ {'lnum': 10, 'col': 6, 'text': 'bar', 'bufnr': g:new_buffer},
\ {'lnum': 10, 'col': 5, 'text': 'foo', 'bufnr': g:new_buffer},
\])
AssertEqual
\ [
\ {'lnum': 10, 'col': 5, 'text': 'foo'},
\ {'lnum': 10, 'col': 6, 'text': 'bar'},
\ {'lnum': 20, 'col': 5, 'text': 'baz'},
\ ],
\ GetList()
Execute(quickfix should be filtered and sorted appropriately for jumping):
let g:ale_set_loclist = 0
let g:ale_set_quickfix = 1
:new
let g:new_buffer = bufnr('%')
AssertNotEqual g:new_buffer, g:buffer
call setqflist([
\ {'lnum': 1, 'col': 1, 'text': 'ignore this', 'bufnr': g:buffer},
\ {'lnum': 20, 'col': 5, 'text': 'baz', 'bufnr': g:new_buffer},
\ {'lnum': 10, 'col': 6, 'text': 'bar', 'bufnr': g:new_buffer},
\ {'lnum': 10, 'col': 5, 'text': 'foo', 'bufnr': g:new_buffer},
\])
AssertEqual
\ [
\ {'lnum': 10, 'col': 5, 'text': 'foo'},
\ {'lnum': 10, 'col': 6, 'text': 'bar'},
\ {'lnum': 20, 'col': 5, 'text': 'baz'},
\ ],
\ GetList()
Execute(An empty List should be returned when both lists are turned off):
let g:ale_set_loclist = 0
let g:ale_set_quickfix = 0
call setqflist([{'lnum': 1, 'col': 1, 'text': 'foo', 'bufnr': bufnr('%')}])
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()
|