2017-07-07 22:47:41 +00:00
|
|
|
Before:
|
2018-07-16 12:46:44 +00:00
|
|
|
Save &filetype
|
|
|
|
Save g:ale_buffer_info
|
|
|
|
Save g:ale_echo_cursor
|
2017-07-07 22:47:41 +00:00
|
|
|
Save g:ale_run_synchronously
|
2018-07-16 12:46:44 +00:00
|
|
|
Save g:ale_set_highlights
|
|
|
|
Save g:ale_set_loclist
|
|
|
|
Save g:ale_set_quickfix
|
|
|
|
Save g:ale_set_signs
|
|
|
|
|
|
|
|
" Enable only the one feature we need.
|
|
|
|
let g:ale_set_signs = 0
|
|
|
|
let g:ale_set_quickfix = 0
|
|
|
|
let g:ale_set_loclist = 1
|
|
|
|
let g:ale_set_highlights = 0
|
|
|
|
let g:ale_echo_cursor = 0
|
2017-07-07 22:47:41 +00:00
|
|
|
|
|
|
|
let g:ale_run_synchronously = 1
|
2019-02-06 22:00:11 +00:00
|
|
|
unlet! g:ale_run_synchronously_callbacks
|
2018-07-16 12:46:44 +00:00
|
|
|
call setloclist(0, [])
|
2017-07-07 22:47:41 +00:00
|
|
|
|
|
|
|
noautocmd let &filetype = 'foobar'
|
|
|
|
|
|
|
|
function! TestCallback(buffer, output)
|
|
|
|
return [{'text': 'x', 'lnum': 1}]
|
|
|
|
endfunction
|
|
|
|
|
2018-07-16 12:46:44 +00:00
|
|
|
call ale#linter#PreventLoading('foobar')
|
2017-07-07 22:47:41 +00:00
|
|
|
call ale#linter#Define('foobar', {
|
|
|
|
\ 'name': 'buffer_linter',
|
|
|
|
\ 'callback': 'TestCallback',
|
2017-10-23 22:09:40 +00:00
|
|
|
\ 'executable': has('win32') ? 'cmd': 'true',
|
2017-07-07 22:47:41 +00:00
|
|
|
\ 'command': 'true',
|
|
|
|
\ 'read_buffer': 0,
|
|
|
|
\})
|
2018-07-16 12:46:44 +00:00
|
|
|
call ale#linter#PreventLoading('foobar2')
|
2017-07-07 22:47:41 +00:00
|
|
|
call ale#linter#Define('foobar2', {
|
|
|
|
\ 'name': 'buffer_linter',
|
|
|
|
\ 'callback': 'TestCallback',
|
2017-10-23 22:09:40 +00:00
|
|
|
\ 'executable': has('win32') ? 'cmd': 'true',
|
2017-07-07 22:47:41 +00:00
|
|
|
\ 'command': 'true',
|
|
|
|
\ 'read_buffer': 0,
|
|
|
|
\})
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
2019-02-06 22:00:11 +00:00
|
|
|
|
|
|
|
unlet! g:ale_run_synchronously_callbacks
|
2017-07-07 22:47:41 +00:00
|
|
|
delfunction TestCallback
|
|
|
|
|
2018-07-16 12:46:44 +00:00
|
|
|
call ale#linter#Reset()
|
|
|
|
call setloclist(0, [])
|
2017-07-07 22:47:41 +00:00
|
|
|
|
|
|
|
Execute(Error should be removed when the filetype changes to something else we cannot check):
|
|
|
|
call ale#Queue(0)
|
2019-02-06 22:00:11 +00:00
|
|
|
call ale#test#FlushJobs()
|
2017-10-23 22:09:40 +00:00
|
|
|
sleep 1ms
|
2017-07-07 22:47:41 +00:00
|
|
|
|
2018-07-23 19:41:06 +00:00
|
|
|
AssertEqual 1, len(ale#test#GetLoclistWithoutModule())
|
2017-07-07 22:47:41 +00:00
|
|
|
|
|
|
|
noautocmd let &filetype = 'foobar2'
|
|
|
|
|
|
|
|
call ale#Queue(0)
|
2019-02-06 22:00:11 +00:00
|
|
|
call ale#test#FlushJobs()
|
2017-10-23 22:09:40 +00:00
|
|
|
sleep 1ms
|
2017-07-07 22:47:41 +00:00
|
|
|
|
|
|
|
" We should get some items from the second filetype.
|
2018-07-23 19:41:06 +00:00
|
|
|
AssertEqual 1, len(ale#test#GetLoclistWithoutModule())
|
2017-07-07 22:47:41 +00:00
|
|
|
|
|
|
|
noautocmd let &filetype = 'xxx'
|
|
|
|
|
|
|
|
call ale#Queue(0)
|
2019-02-06 22:00:11 +00:00
|
|
|
call ale#test#FlushJobs()
|
2017-10-23 22:09:40 +00:00
|
|
|
sleep 1ms
|
2017-07-07 22:47:41 +00:00
|
|
|
|
2018-07-23 19:41:06 +00:00
|
|
|
AssertEqual 0, len(ale#test#GetLoclistWithoutModule())
|