summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-09-02 16:57:01 +0100
committerw0rp <devw0rp@gmail.com>2017-09-02 16:57:01 +0100
commitf9b43a566c156efa28e0e5d5d4ecea76a19672dd (patch)
treeef963166da4b86a5d06e5a85a40757c42a031804 /autoload
parent52eff3bd83a6fb99559c8b9ae693fb965bd6520c (diff)
downloadale-f9b43a566c156efa28e0e5d5d4ecea76a19672dd.zip
#505 - Do not lint files on enter if the option for linting when the filetype changed is on
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/events.vim8
1 files changed, 7 insertions, 1 deletions
diff --git a/autoload/ale/events.vim b/autoload/ale/events.vim
index a3b74677..efae11c1 100644
--- a/autoload/ale/events.vim
+++ b/autoload/ale/events.vim
@@ -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