diff options
author | w0rp <devw0rp@gmail.com> | 2019-05-13 21:57:44 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2019-05-13 21:57:44 +0100 |
commit | 07b596efb52ef56dda212777c30bad58269ce6d9 (patch) | |
tree | a0941f64f6d156ce3a58cac1a1bb6e83a4ee8623 /ale_linters/pug/puglint.vim | |
parent | 70604828fa8a6713f1e7db2e4e58d44f9099ac87 (diff) | |
download | ale-07b596efb52ef56dda212777c30bad58269ce6d9.zip |
Close #791 - Handle exceptions for puglint
Diffstat (limited to 'ale_linters/pug/puglint.vim')
-rw-r--r-- | ale_linters/pug/puglint.vim | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ale_linters/pug/puglint.vim b/ale_linters/pug/puglint.vim index c4e0e233..c819cc45 100644 --- a/ale_linters/pug/puglint.vim +++ b/ale_linters/pug/puglint.vim @@ -31,6 +31,20 @@ function! ale_linters#pug#puglint#GetCommand(buffer) abort \ . ' -r inline %t' endfunction +function! ale_linters#pug#puglint#Handle(buffer, lines) abort + for l:line in a:lines[:10] + if l:line =~# '^SyntaxError: ' + return [{ + \ 'lnum': 1, + \ 'text': 'puglint configuration error (type :ALEDetail for more information)', + \ 'detail': join(a:lines, "\n"), + \}] + endif + endfor + + return ale#handlers#unix#HandleAsError(a:buffer, a:lines) +endfunction + call ale#linter#Define('pug', { \ 'name': 'puglint', \ 'executable': {b -> ale#node#FindExecutable(b, 'pug_puglint', [ @@ -38,5 +52,5 @@ call ale#linter#Define('pug', { \ ])}, \ 'output_stream': 'stderr', \ 'command': function('ale_linters#pug#puglint#GetCommand'), -\ 'callback': 'ale#handlers#unix#HandleAsError', +\ 'callback': 'ale_linters#pug#puglint#Handle', \}) |