mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-16 01:07:06 +08:00
#505 - Do not lint files on enter if the option for linting when the filetype changed is on
This commit is contained in:
@@ -3,6 +3,9 @@ Before:
|
||||
|
||||
let g:ale_set_signs = 1
|
||||
|
||||
call ale#linter#Reset()
|
||||
sign unplace *
|
||||
|
||||
function! GenerateResults(buffer, output)
|
||||
return [
|
||||
\ {
|
||||
|
||||
@@ -3,6 +3,8 @@ Before:
|
||||
|
||||
let g:queue_calls = []
|
||||
|
||||
unlet! b:ale_lint_on_enter
|
||||
|
||||
function! ale#Queue(...)
|
||||
call add(g:queue_calls, a:000)
|
||||
endfunction
|
||||
@@ -10,6 +12,7 @@ Before:
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_lint_on_enter
|
||||
unlet! g:queue_calls
|
||||
|
||||
" Reload the ALE code to load the real function again.
|
||||
@@ -45,3 +48,27 @@ Execute(Linting should be queued when the filetype changes):
|
||||
call ale#events#FileTypeEvent(bufnr(''), 'bazboz')
|
||||
|
||||
AssertEqual [[300, 'lint_file', bufnr('')]], g:queue_calls
|
||||
|
||||
Execute(Linting shouldn't be done when the original filetype was blank and linting on enter is off):
|
||||
let b:ale_lint_on_enter = 0
|
||||
let b:ale_original_filetype = ''
|
||||
|
||||
call ale#events#FileTypeEvent(bufnr(''), 'bazboz')
|
||||
|
||||
AssertEqual [], g:queue_calls
|
||||
|
||||
Execute(Linting should be done when the original filetype was blank and linting on enter is on):
|
||||
let b:ale_lint_on_enter = 1
|
||||
let b:ale_original_filetype = ''
|
||||
|
||||
call ale#events#FileTypeEvent(bufnr(''), 'bazboz')
|
||||
|
||||
AssertEqual [[300, 'lint_file', bufnr('')]], g:queue_calls
|
||||
|
||||
Execute(The new filetype should become the "original" one if the original was blank and linting on enter is off):
|
||||
let b:ale_lint_on_enter = 0
|
||||
let b:ale_original_filetype = ''
|
||||
|
||||
call ale#events#FileTypeEvent(bufnr(''), 'bazboz')
|
||||
|
||||
AssertEqual 'bazboz', b:ale_original_filetype
|
||||
|
||||
Reference in New Issue
Block a user