diff options
author | w0rp <devw0rp@gmail.com> | 2017-04-29 11:58:43 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-04-29 11:58:50 +0100 |
commit | cbb01e32b950f4a5c14d56b41759945662b2db49 (patch) | |
tree | 8b63a1fc19a6d71dd37efc06c4c6ee96ec9e7fe1 /autoload | |
parent | e417dafa780aa62b5b5aed53956bd73a524f9758 (diff) | |
download | ale-cbb01e32b950f4a5c14d56b41759945662b2db49.zip |
Cache executable calls to make things slightly faster
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/engine.vim | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim index b5ea156f..047392d0 100644 --- a/autoload/ale/engine.vim +++ b/autoload/ale/engine.vim @@ -8,6 +8,23 @@ " buffer: The buffer number for the job. " output: The array of lines for the output of the job. let s:job_info_map = {} +let s:executable_cache_map = {} + +" Check if files are executable, and if they are, remember that they are +" for subsequent calls. We'll keep checking until programs can be executed. +function! s:IsExecutable(executable) abort + if has_key(s:executable_cache_map, a:executable) + return 1 + endif + + if executable(a:executable) + let s:executable_cache_map[a:executable] = 1 + + return 1 + endif + + return 0 +endfunction function! ale#engine#ParseVim8ProcessID(job_string) abort return matchstr(a:job_string, '\d\+') + 0 @@ -722,7 +739,7 @@ function! ale#engine#Invoke(buffer, linter) abort \ : a:linter.executable " Run this program if it can be executed. - if executable(l:executable) + if s:IsExecutable(l:executable) call s:InvokeChain(a:buffer, a:linter, 0, []) endif endfunction |