diff options
author | w0rp <w0rp@users.noreply.github.com> | 2017-11-17 16:34:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-17 16:34:01 +0000 |
commit | 0e96d4576ad44ab66c075eed83d71ed0451dc645 (patch) | |
tree | c48d61357fdeeceee8b5bd9267acb7274fd19222 /autoload | |
parent | 5635b3c86437f22123a19601bebcaa335c1ceb2e (diff) | |
parent | 79f15b0e3050b9ca2ddd82a6712b5bfcb934cadb (diff) | |
download | ale-0e96d4576ad44ab66c075eed83d71ed0451dc645.zip |
Merge pull request #1142 from rhysd/redpen-ext
* redpen support for asciidoc, reST, LaTeX and Re:VIEW
* redpen: fix start column
* add redpen as text linter
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/handlers/redpen.vim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/autoload/ale/handlers/redpen.vim b/autoload/ale/handlers/redpen.vim new file mode 100644 index 00000000..35ff8c17 --- /dev/null +++ b/autoload/ale/handlers/redpen.vim @@ -0,0 +1,29 @@ +" Author: rhysd https://rhysd.github.io +" Description: Redpen, a proofreading tool (http://redpen.cc) + +function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort + " Only one file was passed to redpen. So response array has only one + " element. + let l:res = json_decode(join(a:lines))[0] + let l:output = [] + for l:err in l:res.errors + let l:item = { + \ 'text': l:err.message . ' (' . l:err.validator . ')', + \ 'type': 'W', + \} + if has_key(l:err, 'startPosition') + let l:item.lnum = l:err.startPosition.lineNum + let l:item.col = l:err.startPosition.offset + 1 + if has_key(l:err, 'endPosition') + let l:item.end_lnum = l:err.endPosition.lineNum + let l:item.end_col = l:err.endPosition.offset + endif + else + let l:item.lnum = l:err.lineNum + let l:item.col = l:err.sentenceStartColumnNum + 1 + endif + call add(l:output, l:item) + endfor + return l:output +endfunction + |