diff options
author | w0rp <devw0rp@gmail.com> | 2018-04-12 20:31:33 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-04-12 20:31:45 +0100 |
commit | 0cd8e8630b69613df3a2a65fdd830364de157129 (patch) | |
tree | 43f28b61ee1893537999007e0cb5df6a0708992b /autoload/ale.vim | |
parent | 3401a4e8ea35608d90a6cf709a790a37f112d201 (diff) | |
download | ale-0cd8e8630b69613df3a2a65fdd830364de157129.zip |
#1497 Tolerate important ALE variables being undefined for some reason when viewing buffers like git commits
Diffstat (limited to 'autoload/ale.vim')
-rw-r--r-- | autoload/ale.vim | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim index f6c06cf1..5c4a0f55 100644 --- a/autoload/ale.vim +++ b/autoload/ale.vim @@ -33,6 +33,10 @@ endfunction " Return 1 if a file is too large for ALE to handle. function! ale#FileTooLarge() abort + if !exists('g:ale_maximum_file_size') + return 0 + endif + let l:max = ale#Var(bufnr(''), 'maximum_file_size') return l:max > 0 ? (line2byte(line('$') + 1) > l:max) : 0 @@ -46,13 +50,18 @@ function! ale#ShouldDoNothing(buffer) abort " The checks are split into separate if statements to make it possible to " profile each check individually with Vim's profiling tools. + " Do nothing if ALE is disabled. + if !getbufvar(a:buffer, 'ale_enabled', get(g:, 'ale_enabled', 0)) + return 1 + endif + " Don't perform any checks when newer NeoVim versions are exiting. if get(v:, 'exiting', v:null) isnot v:null return 1 endif " Do nothing for blacklisted files - if index(g:ale_filetype_blacklist, getbufvar(a:buffer, '&filetype')) >= 0 + if index(get(g:, 'ale_filetype_blacklist', []), getbufvar(a:buffer, '&filetype')) >= 0 return 1 endif @@ -72,11 +81,6 @@ function! ale#ShouldDoNothing(buffer) abort return 1 endif - " Do nothing if ALE is disabled. - if !ale#Var(a:buffer, 'enabled') - return 1 - endif - " Do nothing if the file is too large. if ale#FileTooLarge() return 1 |