All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: Andrew Balmos - <andrew@balmos.org>
2 " Description: chktex for LaTeX files
4 call ale#Set('tex_chktex_executable', 'chktex')
5 call ale#Set('tex_chktex_options', '-I')
7 function! ale_linters#tex#chktex#GetExecutable(buffer) abort
8 return ale#Var(a:buffer, 'tex_chktex_executable')
11 function! ale_linters#tex#chktex#GetCommand(buffer, version) abort
14 " Avoid bug when used without -p (last warning has gibberish for a filename)
15 let l:options .= ' -v0 -p stdin -q'
17 " Avoid bug of reporting wrong column when using tabs (issue #723)
18 if ale#semver#GTE(a:version, [1, 7, 7])
19 let l:options .= ' -S TabSize=1'
22 " Check for optional .chktexrc
23 let l:chktex_config = ale#path#FindNearestFile(a:buffer, '.chktexrc')
25 if !empty(l:chktex_config)
26 let l:options .= ' -l ' . ale#Escape(l:chktex_config)
29 let l:options .= ' ' . ale#Var(a:buffer, 'tex_chktex_options')
31 return '%e' . l:options
34 function! ale_linters#tex#chktex#Handle(buffer, lines) abort
37 " stdin:499:2:24:Delete this space to maintain correct pagereferences.
38 " stdin:507:81:3:You should enclose the previous parenthesis with `{}'.
39 let l:pattern = '^stdin:\(\d\+\):\(\d\+\):\(\d\+\):\(.\+\)$'
42 for l:match in ale#util#GetMatches(a:lines, l:pattern)
44 \ 'lnum': l:match[1] + 0,
45 \ 'col': l:match[2] + 0,
46 \ 'text': l:match[4] . ' (' . (l:match[3]+0) . ')',
54 call ale#linter#Define('tex', {
56 \ 'executable': function('ale_linters#tex#chktex#GetExecutable'),
57 \ 'command': {buffer -> ale#semver#RunWithVersionCheck(
59 \ ale_linters#tex#chktex#GetExecutable(buffer),
61 \ function('ale_linters#tex#chktex#GetCommand'),
63 \ 'callback': 'ale_linters#tex#chktex#Handle'