summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorrhysd <lin90162@yahoo.co.jp>2017-11-16 19:28:30 +0900
committerrhysd <lin90162@yahoo.co.jp>2017-11-16 19:28:30 +0900
commitf1314b285c7b489f7b879a1afd703b60a877a52e (patch)
tree6a2cbd86ea0413aedb9fb9a71e0f4c007da02341 /ale_linters
parentc9c52ef370f6abbcf60220e047faebd294bd738b (diff)
downloadale-f1314b285c7b489f7b879a1afd703b60a877a52e.zip
redpen: support end_lnum and end_col if possible
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/markdown/redpen.vim27
1 files changed, 15 insertions, 12 deletions
diff --git a/ale_linters/markdown/redpen.vim b/ale_linters/markdown/redpen.vim
index 00a19a93..38fe2308 100644
--- a/ale_linters/markdown/redpen.vim
+++ b/ale_linters/markdown/redpen.vim
@@ -5,23 +5,26 @@ function! ale_linters#markdown#redpen#HandleErrors(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:errors = []
+ 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:lnum = l:err.startPosition.lineNum
- let l:col = l:err.startPosition.offset
+ let l:item.lnum = l:err.startPosition.lineNum
+ let l:item.col = l:err.startPosition.offset
+ 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:lnum = l:err.lineNum
- let l:col = l:err.sentenceStartColumnNum + 1
+ let l:item.lnum = l:err.lineNum
+ let l:item.col = l:err.sentenceStartColumnNum + 1
endif
- call add(l:errors, {
- \ 'lnum': l:lnum,
- \ 'col': l:col,
- \ 'text': l:err.message . ' (' . l:err.validator . ')',
- \ 'type': 'W',
- \})
+ call add(l:output, l:item)
endfor
- return l:errors
+ return l:output
endfunction
call ale#linter#Define('markdown', {