summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/handlers/redpen.vim5
-rw-r--r--test/handler/test_redpen_handler.vader6
2 files changed, 8 insertions, 3 deletions
diff --git a/autoload/ale/handlers/redpen.vim b/autoload/ale/handlers/redpen.vim
index 35ff8c17..2fb05684 100644
--- a/autoload/ale/handlers/redpen.vim
+++ b/autoload/ale/handlers/redpen.vim
@@ -8,8 +8,9 @@ function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort
let l:output = []
for l:err in l:res.errors
let l:item = {
- \ 'text': l:err.message . ' (' . l:err.validator . ')',
+ \ 'text': l:err.message,
\ 'type': 'W',
+ \ 'code': l:err.validator,
\}
if has_key(l:err, 'startPosition')
let l:item.lnum = l:err.startPosition.lineNum
@@ -19,6 +20,8 @@ function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort
let l:item.end_col = l:err.endPosition.offset
endif
else
+ " Fallback to a whole sentence region when a region is not
+ " specified by the error.
let l:item.lnum = l:err.lineNum
let l:item.col = l:err.sentenceStartColumnNum + 1
endif
diff --git a/test/handler/test_redpen_handler.vader b/test/handler/test_redpen_handler.vader
index 46276144..f28d6923 100644
--- a/test/handler/test_redpen_handler.vader
+++ b/test/handler/test_redpen_handler.vader
@@ -12,14 +12,16 @@ Execute(redpen handler should handle errors output):
\ 'col': 10,
\ 'end_lnum': 1,
\ 'end_col': 15,
- \ 'text': 'Found possibly misspelled word "plugin". (Spelling)',
+ \ 'text': 'Found possibly misspelled word "plugin".',
\ 'type': 'W',
+ \ 'code': 'Spelling',
\ },
\ {
\ 'lnum': 1,
\ 'col': 1,
- \ 'text': 'Found possibly misspelled word "NeoVim". (Spelling)',
+ \ 'text': 'Found possibly misspelled word "NeoVim".',
\ 'type': 'W',
+ \ 'code': 'Spelling',
\ },
\ ],
\ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [