diff options
author | w0rp <devw0rp@gmail.com> | 2017-06-06 09:47:08 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-06-06 09:47:22 +0100 |
commit | 02ac28dbe6ae2b60d359d601c20f9f7f532a49f6 (patch) | |
tree | ff5557682ff28e61361487bd06635df4f277fd03 /ale_linters/vim | |
parent | f6109d2e4e73f59bbc8eec6092f085de17187590 (diff) | |
download | ale-02ac28dbe6ae2b60d359d601c20f9f7f532a49f6.zip |
Fix #624 - Ask for the Vint version in the background
Diffstat (limited to 'ale_linters/vim')
-rw-r--r-- | ale_linters/vim/vint.vim | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/ale_linters/vim/vint.vim b/ale_linters/vim/vint.vim index 1bb3a5b9..2f506c20 100644 --- a/ale_linters/vim/vint.vim +++ b/ale_linters/vim/vint.vim @@ -4,18 +4,32 @@ " This flag can be used to change enable/disable style issues. let g:ale_vim_vint_show_style_issues = \ get(g:, 'ale_vim_vint_show_style_issues', 1) - -let s:vint_version = ale#semver#Parse(system('vint --version')) -let s:can_use_no_color_flag = ale#semver#GreaterOrEqual(s:vint_version, [0, 3, 7]) let s:enable_neovim = has('nvim') ? ' --enable-neovim ' : '' let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"' -function! ale_linters#vim#vint#GetCommand(buffer) abort +function! ale_linters#vim#vint#VersionCommand(buffer) abort + if !exists('s:vint_version') + " Check the Vint version if we haven't checked it already. + return 'vint --version' + endif + + return '' +endfunction + +function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort + if !empty(a:version_output) + " Parse the version out of the --version output. + let s:vint_version = ale#semver#Parse(join(a:version_output, "\n")) + endif + + let l:can_use_no_color_flag = exists('s:vint_version') + \ && ale#semver#GreaterOrEqual(s:vint_version, [0, 3, 7]) + let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w' return 'vint ' \ . l:warning_flag . ' ' - \ . (s:can_use_no_color_flag ? '--no-color ' : '') + \ . (l:can_use_no_color_flag ? '--no-color ' : '') \ . s:enable_neovim \ . s:format \ . ' %t' @@ -24,6 +38,9 @@ endfunction call ale#linter#Define('vim', { \ 'name': 'vint', \ 'executable': 'vint', -\ 'command_callback': 'ale_linters#vim#vint#GetCommand', +\ 'command_chain': [ +\ {'callback': 'ale_linters#vim#vint#VersionCommand', 'output_stream': 'stderr'}, +\ {'callback': 'ale_linters#vim#vint#GetCommand', 'output_stream': 'stdout'}, +\ ], \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \}) |