diff options
author | w0rp <devw0rp@gmail.com> | 2017-10-14 16:51:12 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-10-14 16:51:12 +0100 |
commit | 5204f2dbc27194818e9cddc8cb01a6171bf4e18c (patch) | |
tree | 794cb2b5987fb948f04b83e5108225d9a9c73cfd /autoload/ale.vim | |
parent | 618074a0535a700c60456f7c28db477c559989ec (diff) | |
download | ale-5204f2dbc27194818e9cddc8cb01a6171bf4e18c.zip |
Break up ShouldDoNothing checks into separate lines, so it's possible to profile them
Diffstat (limited to 'autoload/ale.vim')
-rw-r--r-- | autoload/ale.vim | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim index 6941a9a5..2172c47b 100644 --- a/autoload/ale.vim +++ b/autoload/ale.vim @@ -41,14 +41,40 @@ endfunction " A function for checking various conditions whereby ALE just shouldn't " attempt to do anything, say if particular buffer types are open in Vim. 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 for blacklisted files - " OR if ALE is running in the sandbox - return index(g:ale_filetype_blacklist, &filetype) >= 0 - \ || (exists('*getcmdwintype') && !empty(getcmdwintype())) - \ || ale#util#InSandbox() - \ || !ale#Var(a:buffer, 'enabled') - \ || ale#FileTooLarge() - \ || getbufvar(a:buffer, '&l:statusline') =~# 'CtrlPMode.*funky' + if index(g:ale_filetype_blacklist, &filetype) >= 0 + return 1 + endif + + " Do nothing if running from command mode + if exists('*getcmdwintype') && !empty(getcmdwintype()) + return 1 + endif + + " Do nothing if running in the sandbox + if ale#util#InSandbox() + 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 + endif + + " Do nothing from CtrlP buffers with CtrlP-funky. + if getbufvar(a:buffer, '&l:statusline') =~# 'CtrlPMode.*funky' + return 1 + endif + + return 0 endfunction " (delay, [linting_flag, buffer_number]) |