Fix #1176 - Add an option for caching failing executable checks

This commit is contained in:
w0rp
2017-11-30 10:34:51 +00:00
parent fd261264d7
commit a990188e27
4 changed files with 57 additions and 7 deletions

View File

@@ -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
" Check for a cached executable() check.
let l:result = get(s:executable_cache_map, a:executable, v:null)
if l:result isnot v:null
return l:result
endif
let l:result = 0
" Check if the file is executable, and convert -1 to 1.
let l:result = executable(a:executable) isnot 0
if executable(a:executable)
let s:executable_cache_map[a:executable] = 1
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