Skip to content

Commit

Permalink
Rework of the haskell/ghc-mod checker.
Browse files Browse the repository at this point in the history
  • Loading branch information
lcd047 committed Apr 25, 2013
1 parent 2c894c9 commit 9493124
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions syntax_checkers/haskell/ghc-mod.vim
Expand Up @@ -15,26 +15,32 @@ if exists("g:loaded_syntastic_haskell_ghc_mod_checker")
endif
let g:loaded_syntastic_haskell_ghc_mod_checker=1

if !exists('g:syntastic_haskell_checker_args')
let g:syntastic_haskell_checker_args = '--hlintOpt="--language=XmlSyntax"'
endif

function! SyntaxCheckers_haskell_ghc_mod_IsAvailable()
return executable('ghc-mod')
endfunction

function! SyntaxCheckers_haskell_ghc_mod_GetLocList()
let ghcmod = 'ghc-mod ' . g:syntastic_haskell_checker_args
let makeprg =
\ "{ ".
\ ghcmod . " check ". shellescape(expand('%')) . "; " .
\ ghcmod . " lint " . shellescape(expand('%')) . ";" .
\ " }"
let errorformat = '%-G\\s%#,%f:%l:%c:%trror: %m,%f:%l:%c:%tarning: %m,'.
\ '%f:%l:%c: %trror: %m,%f:%l:%c: %tarning: %m,%f:%l:%c:%m,'.
\ '%E%f:%l:%c:,%Z%m,'
let errorformat =
\ '%-G%\s%#,' .
\ '%f:%l:%c:%trror: %m,' .
\ '%f:%l:%c:%tarning: %m,'.
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c:%m,' .
\ '%E%f:%l:%c:,' .
\ '%Z%m'

let makeprg = syntastic#makeprg#build({
\ 'exe': 'ghc-mod check',
\ 'args': '--hlintOpt="--language=XmlSyntax"' })
let loclist1 = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })

let makeprg = syntastic#makeprg#build({
\ 'exe': 'ghc-mod lint',
\ 'args': '--hlintOpt="--language=XmlSyntax"' })
let loclist2 = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })

return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
return loclist1 + loclist2
endfunction

call g:SyntasticRegistry.CreateAndRegisterChecker({
Expand Down

0 comments on commit 9493124

Please sign in to comment.