summaryrefslogtreecommitdiff
path: root/ale_linters/haskell
diff options
context:
space:
mode:
authorBjorn Neergaard <bjorn@neersighted.com>2016-10-11 09:22:47 -0500
committerBjorn Neergaard <bjorn@neersighted.com>2016-10-11 09:22:47 -0500
commitc290e2cd602a20f71880ea1d210797fad2db8000 (patch)
tree98e2e16273dc4318c21d1295fe58e584f1233cfa /ale_linters/haskell
parentd8d08de26cb17c9319a08c0c5f611c6778260030 (diff)
downloadale-c290e2cd602a20f71880ea1d210797fad2db8000.zip
Remove many redundant handlers
Diffstat (limited to 'ale_linters/haskell')
-rw-r--r--ale_linters/haskell/ghc.vim55
1 files changed, 2 insertions, 53 deletions
diff --git a/ale_linters/haskell/ghc.vim b/ale_linters/haskell/ghc.vim
index 275cf32f..29aef123 100644
--- a/ale_linters/haskell/ghc.vim
+++ b/ale_linters/haskell/ghc.vim
@@ -7,63 +7,12 @@ endif
let g:loaded_ale_linters_haskell_ghc = 1
-function! ale_linters#haskell#ghc#Handle(buffer, lines)
- " Look for lines like the following.
- "
- " /dev/stdin:28:26: Not in scope: `>>>>>'
- let l:pattern = '^[^:]\+:\(\d\+\):\(\d\+\): \(.\+\)$'
- let l:output = []
-
- " For some reason the output coming out of the GHC through the wrapper
- " script breaks the lines up in strange ways. So we have to join some
- " lines back together again.
- let l:corrected_lines = []
-
- for l:line in a:lines
- if len(matchlist(l:line, l:pattern)) > 0
- call add(l:corrected_lines, l:line)
- if l:line !~# ': error:$'
- call add(l:corrected_lines, '')
- endif
- elseif l:line ==# ''
- call add(l:corrected_lines, l:line)
- else
- if len(l:corrected_lines) > 0
- if l:corrected_lines[-1] =~# ': error:$'
- let l:line = substitute(l:line, '\v^\s+', ' ', '')
- endif
- let l:corrected_lines[-1] .= l:line
- endif
- endif
- endfor
-
- for l:line in l:corrected_lines
- let l:match = matchlist(l:line, l:pattern)
-
- if len(l:match) == 0
- continue
- endif
-
- call add(l:output, {
- \ 'bufnr': a:buffer,
- \ 'lnum': l:match[1] + 0,
- \ 'vcol': 0,
- \ 'col': l:match[2] + 0,
- \ 'text': l:match[3],
- \ 'type': 'E',
- \ 'nr': -1,
- \})
- endfor
-
- return l:output
-endfunction
-
call ale#linter#Define('haskell', {
\ 'name': 'ghc',
\ 'output_stream': 'stderr',
\ 'executable': 'ghc',
\ 'command': g:ale#util#stdin_wrapper . ' .hs ghc -fno-code -v0',
-\ 'callback': 'ale_linters#haskell#ghc#Handle',
+\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
\})
call ale#linter#Define('haskell', {
@@ -71,5 +20,5 @@ call ale#linter#Define('haskell', {
\ 'output_stream': 'stderr',
\ 'executable': 'stack',
\ 'command': g:ale#util#stdin_wrapper . ' .hs stack ghc -- -fno-code -v0',
-\ 'callback': 'ale_linters#haskell#ghc#Handle',
+\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
\})