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.
2 " Author: Johannes Wienke <languitar@semipol.de>
3 " Description: Error handling for errors in alex output format
5 function! ale#handlers#alex#GetExecutable(buffer) abort
6 return ale#path#FindExecutable(a:buffer, 'alex', [
7 \ 'node_modules/.bin/alex',
8 \ 'node_modules/alex/cli.js',
12 function! ale#handlers#alex#CreateCommandCallback(flags) abort
13 return {b -> ale#node#Executable(b, ale#handlers#alex#GetExecutable(b))
19 function! ale#handlers#alex#Handle(buffer, lines) abort
21 " 6:256-6:262 warning Be careful with “killed”, it’s profane in some cases killed retext-profanities
22 let l:pattern = '\v^ *(\d+):(\d+)-(\d+):(\d+) +warning +(.{-}) +(.{-}) +(.{-})$'
25 for l:match in ale#util#GetMatches(a:lines, l:pattern)
27 \ 'lnum': l:match[1] + 0,
28 \ 'col': l:match[2] + 0,
29 \ 'end_lnum': l:match[3] + 0,
30 \ 'end_col': l:match[4] - 1,
31 \ 'text': l:match[5] . ' (' . (l:match[7]) . ')',
39 " Define a linter for a specific filetype. Accept flags to adapt to the filetype.
40 " no flags treat input as markdown
41 " --html treat input as HTML
42 " --mdx treat input as MDX
43 " --text treat input as plaintext
44 function! ale#handlers#alex#DefineLinter(filetype, flags) abort
45 call ale#Set('alex_executable', 'alex')
46 call ale#Set('alex_use_global', get(g:, 'ale_use_global_executables', 0))
48 call ale#linter#Define(a:filetype, {
50 \ 'executable': function('ale#handlers#alex#GetExecutable'),
51 \ 'command': ale#handlers#alex#CreateCommandCallback(a:flags),
52 \ 'output_stream': 'stderr',
53 \ 'callback': 'ale#handlers#alex#Handle',