diff options
author | Johannes Wienke <languitar@semipol.de> | 2017-12-13 14:19:56 +0100 |
---|---|---|
committer | Johannes Wienke <languitar@semipol.de> | 2017-12-13 14:37:42 +0100 |
commit | 55ca96bd8310737da5e2f7d21587dcdbe6c9f011 (patch) | |
tree | 37b4202596c2b6fd80516309dc10353865fce248 /autoload | |
parent | 7a88a3605c9bc270bcbc00fbf11aaf2a825d7bae (diff) | |
download | ale-55ca96bd8310737da5e2f7d21587dcdbe6c9f011.zip |
Add a linter for alex
https://github.com/wooorm/alex
Enabled for text-like file formats and documented in README and doc.
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/handlers/alex.vim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/autoload/ale/handlers/alex.vim b/autoload/ale/handlers/alex.vim new file mode 100644 index 00000000..853d3137 --- /dev/null +++ b/autoload/ale/handlers/alex.vim @@ -0,0 +1,22 @@ +" Author: Johannes Wienke <languitar@semipol.de> +" Description: Error handling for errors in alex output format + +function! ale#handlers#alex#Handle(buffer, lines) abort + " Example output: + " 6:256-6:262 warning Be careful with “killed”, it’s profane in some cases killed retext-profanities + let l:pattern = '^ *\(\d\+\):\(\d\+\)-\(\d\+\):\(\d\+\) \+warning \+\(.\{-\}\) \+\(.\{-\}\) \+\(.\{-\}\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'end_lnum': l:match[3] + 0, + \ 'end_col': l:match[4] - 1, + \ 'text': l:match[5] . ' (' . (l:match[7]) . ')', + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction |