mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-02 09:33:31 +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:
@@ -33,7 +33,13 @@ 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
|
||||
" If we're setting the filetype for the first time after it was blank,
|
||||
" and the option for linting on enter is off, then we should set this
|
||||
" filetype as the original filetype. Otherwise ALE will still appear to
|
||||
" lint files because of the BufEnter event, etc.
|
||||
if empty(l:filetype) && !ale#Var(a:buffer, 'lint_on_enter')
|
||||
call setbufvar(a:buffer, 'ale_original_filetype', a:new_filetype)
|
||||
elseif a:new_filetype isnot# l:filetype
|
||||
call ale#Queue(300, 'lint_file', a:buffer)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user