diff options
author | Rob Berry <rob@luvhate.us> | 2016-12-14 12:50:14 +0000 |
---|---|---|
committer | Rob Berry <rob@luvhate.us> | 2016-12-14 12:50:14 +0000 |
commit | 0ffef758aed0d944e778ac2bab749c708d2ce737 (patch) | |
tree | 4d83fb3c0d9126993f5f1bfd04bad4b5410d47c1 | |
parent | 3a1caca907ca889167720a39eef60aa2a762cc18 (diff) | |
download | ale-0ffef758aed0d944e778ac2bab749c708d2ce737.zip |
Improve formatting of ghc and hlint haskell linters
For ghc, it seemed that the conditional
```
if l:corrected_lines[-1] =~# ': error:$'
let l:line = substitute(l:line, '\v^\s+', ' ', '')
endif
```
was never being reached. It's actually better to unconditionally
collapse whitespace anyway and so I simply removed the conditional
check.
For hlint I added more information about the error. This changes the
reported error from `Error:` to something like:
` Error: Avoid lambda. Found: \ x -> foo x Why not: foo`
-rw-r--r-- | ale_linters/haskell/ghc.vim | 4 | ||||
-rw-r--r-- | ale_linters/haskell/hlint.vim | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/ale_linters/haskell/ghc.vim b/ale_linters/haskell/ghc.vim index 275cf32f..def883e3 100644 --- a/ale_linters/haskell/ghc.vim +++ b/ale_linters/haskell/ghc.vim @@ -29,9 +29,7 @@ function! ale_linters#haskell#ghc#Handle(buffer, lines) 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:line = substitute(l:line, '\v\s+', ' ', '') let l:corrected_lines[-1] .= l:line endif endif diff --git a/ale_linters/haskell/hlint.vim b/ale_linters/haskell/hlint.vim index f698d5b4..3aa93fa1 100644 --- a/ale_linters/haskell/hlint.vim +++ b/ale_linters/haskell/hlint.vim @@ -13,7 +13,7 @@ function! ale_linters#haskell#hlint#Handle(buffer, lines) \ 'lnum': l:error.startLine + 0, \ 'vcol': 0, \ 'col': l:error.startColumn + 0, - \ 'text': l:error.severity . ': ' . l:error.hint, + \ 'text': l:error.severity . ': ' . l:error.hint . '. Found: ' . l:error.from . ' Why not: ' . l:error.to, \ 'type': l:error.severity ==# 'Error' ? 'E' : 'W', \}) endfor |