mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-03 10:03:47 +08:00
Set up one BufEnter event used for everything, and add tests for linting when the filetype changes
This commit is contained in:
@@ -24,9 +24,20 @@ function! s:LintOnEnter(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale#events#EnterEvent(buffer) abort
|
||||
let l:filetype = getbufvar(a:buffer, '&filetype')
|
||||
call setbufvar(a:buffer, 'ale_original_filetype', l:filetype)
|
||||
|
||||
call s:LintOnEnter(a:buffer)
|
||||
endfunction
|
||||
|
||||
function! ale#events#FileTypeEvent(buffer, new_filetype) abort
|
||||
let l:filetype = getbufvar(a:buffer, 'ale_original_filetype', '')
|
||||
|
||||
if a:new_filetype isnot# l:filetype
|
||||
call ale#Queue(300, 'lint_file', a:buffer)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#events#FileChangedEvent(buffer) abort
|
||||
call setbufvar(a:buffer, 'ale_file_changed', 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user