Merge pull request #741 from zenzike/master

Detangle ghc-mod and hlint
This commit is contained in:
LCD 47 2013-07-29 08:41:14 -07:00
commit bcbc422d26
2 changed files with 41 additions and 12 deletions

View File

@ -32,23 +32,14 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList()
let makeprg = syntastic#makeprg#build({ let makeprg = syntastic#makeprg#build({
\ 'exe': 'ghc-mod check', \ 'exe': 'ghc-mod check',
\ 'args': '--hlintOpt="--language=XmlSyntax"',
\ 'filetype': 'haskell', \ 'filetype': 'haskell',
\ 'subchecker': 'ghc_mod' }) \ 'subchecker': 'ghc_mod' })
let loclist1 = SyntasticMake({
let loclist = SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat }) \ 'errorformat': errorformat })
let makeprg = syntastic#makeprg#build({ return loclist
\ 'exe': 'ghc-mod lint',
\ 'args': '--hlintOpt="--language=XmlSyntax"',
\ 'filetype': 'haskell',
\ 'subchecker': 'ghc_mod' })
let loclist2 = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
return loclist1 + loclist2
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -0,0 +1,38 @@
"============================================================================
"File: hlint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Nicolas Wu <nicolas.wu at gmail dot com>
"License: BSD
"============================================================================
if exists("g:loaded_syntastic_haskell_hlint_checker")
finish
endif
let g:loaded_syntastic_haskell_hlint_checker=1
function! SyntaxCheckers_haskell_hlint_IsAvailable()
return executable('hlint')
endfunction
function! SyntaxCheckers_haskell_hlint_GetLocList()
let errorformat =
\ '%E%f:%l:%c: Error: %m,' .
\ '%W%f:%l:%c: Warning: %m,' .
\ '%C%m'
let makeprg = syntastic#makeprg#build({
\ 'exe': 'hlint',
\ 'filetype': 'haskell',
\ 'subchecker': 'hlint' })
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['compressWhitespace'] })
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'haskell',
\ 'name': 'hlint'})