summaryrefslogtreecommitdiff
path: root/ale_linters/haskell
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/haskell')
-rw-r--r--ale_linters/haskell/hlint.vim21
1 files changed, 17 insertions, 4 deletions
diff --git a/ale_linters/haskell/hlint.vim b/ale_linters/haskell/hlint.vim
index 77952cf4..accae374 100644
--- a/ale_linters/haskell/hlint.vim
+++ b/ale_linters/haskell/hlint.vim
@@ -2,17 +2,30 @@
" Description: hlint for Haskell files
function! ale_linters#haskell#hlint#Handle(buffer, lines) abort
+ if empty(a:lines)
+ return []
+ endif
+
let l:errors = json_decode(join(a:lines, ''))
let l:output = []
for l:error in l:errors
+ if l:error.severity ==# 'Error'
+ let l:type = 'E'
+ elseif l:error.severity ==# 'Suggestion'
+ let l:type = 'I'
+ else
+ let l:type = 'W'
+ endif
+
call add(l:output, {
- \ 'bufnr': a:buffer,
- \ 'lnum': l:error.startLine + 0,
- \ 'col': l:error.startColumn + 0,
+ \ 'lnum': str2nr(l:error.startLine),
+ \ 'col': str2nr(l:error.startColumn),
+ \ 'end_lnum': str2nr(l:error.endLine),
+ \ 'end_col': str2nr(l:error.endColumn),
\ 'text': l:error.severity . ': ' . l:error.hint . '. Found: ' . l:error.from . ' Why not: ' . l:error.to,
- \ 'type': l:error.severity ==# 'Error' ? 'E' : 'W',
+ \ 'type': l:type,
\})
endfor