diff options
Diffstat (limited to 'ale_linters/tex/chktex.vim')
-rw-r--r-- | ale_linters/tex/chktex.vim | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/ale_linters/tex/chktex.vim b/ale_linters/tex/chktex.vim index b4eacb82..9e7be587 100644 --- a/ale_linters/tex/chktex.vim +++ b/ale_linters/tex/chktex.vim @@ -4,12 +4,20 @@ call ale#Set('tex_chktex_executable', 'chktex') call ale#Set('tex_chktex_options', '-I') -function! ale_linters#tex#chktex#GetCommand(buffer) abort +function! ale_linters#tex#chktex#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'tex_chktex_executable') +endfunction + +function! ale_linters#tex#chktex#GetCommand(buffer, version) abort let l:options = '' " Avoid bug when used without -p (last warning has gibberish for a filename) let l:options .= ' -v0 -p stdin -q' + " Avoid bug of reporting wrong column when using tabs (issue #723) + if ale#semver#GTE(a:version, [1, 7, 7]) + let l:options .= ' -S TabSize=1' + endif " Check for optional .chktexrc let l:chktex_config = ale#path#FindNearestFile(a:buffer, '.chktexrc') @@ -45,7 +53,12 @@ endfunction call ale#linter#Define('tex', { \ 'name': 'chktex', -\ 'executable': {b -> ale#Var(b, 'tex_chktex_executable')}, -\ 'command': function('ale_linters#tex#chktex#GetCommand'), +\ 'executable': function('ale_linters#tex#chktex#GetExecutable'), +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#tex#chktex#GetExecutable(buffer), +\ '%e --version', +\ function('ale_linters#tex#chktex#GetCommand'), +\ )}, \ 'callback': 'ale_linters#tex#chktex#Handle' \}) |