diff options
author | w0rp <devw0rp@gmail.com> | 2017-11-30 10:34:51 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-11-30 10:34:51 +0000 |
commit | a990188e276aad9410bc6fd1b627153fb279ffac (patch) | |
tree | a353be5794f9e8528b80764c1dcb3c7c52d6520b /autoload | |
parent | fd261264d7020699d76ed2f6eecd9800ef5f5b9f (diff) | |
download | ale-a990188e276aad9410bc6fd1b627153fb279ffac.zip |
Fix #1176 - Add an option for caching failing executable checks
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/engine.vim | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim index 811b2438..150b53c1 100644 --- a/autoload/ale/engine.vim +++ b/autoload/ale/engine.vim @@ -32,16 +32,20 @@ function! ale#engine#IsExecutable(buffer, executable) abort return 0 endif - if has_key(s:executable_cache_map, a:executable) - return 1 - endif + " Check for a cached executable() check. + let l:result = get(s:executable_cache_map, a:executable, v:null) - let l:result = 0 + if l:result isnot v:null + return l:result + endif - if executable(a:executable) - let s:executable_cache_map[a:executable] = 1 + " Check if the file is executable, and convert -1 to 1. + let l:result = executable(a:executable) isnot 0 - let l:result = 1 + " Cache the executable check if we found it, or if the option to cache + " failing checks is on. + if l:result || g:ale_cache_executable_check_failures + let s:executable_cache_map[a:executable] = l:result endif if g:ale_history_enabled |