summaryrefslogtreecommitdiff
path: root/ale_linters/pug
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/pug')
-rw-r--r--ale_linters/pug/puglint.vim16
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',
\})