2013-07-29 12:52:22 +01:00
|
|
|
"============================================================================
|
|
|
|
"File: hlint.vim
|
2017-09-15 21:04:16 +03:00
|
|
|
"Description: Syntax checking plugin for syntastic
|
2013-07-29 12:52:22 +01:00
|
|
|
"Maintainer: Nicolas Wu <nicolas.wu at gmail dot com>
|
|
|
|
"License: BSD
|
|
|
|
"============================================================================
|
|
|
|
|
2013-08-12 22:46:20 +03:00
|
|
|
if exists('g:loaded_syntastic_haskell_hlint_checker')
|
2013-07-29 12:52:22 +01:00
|
|
|
finish
|
|
|
|
endif
|
2013-08-12 22:46:20 +03:00
|
|
|
let g:loaded_syntastic_haskell_hlint_checker = 1
|
2013-07-29 12:52:22 +01:00
|
|
|
|
2014-01-03 11:29:08 +02:00
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
|
2019-03-07 20:02:16 +02:00
|
|
|
function! SyntaxCheckers_haskell_hlint_IsAvailable() dict
|
|
|
|
if !executable(self.getExec())
|
|
|
|
return 0
|
|
|
|
endif
|
|
|
|
return syntastic#util#versionIsAtLeast(self.getVersion(), [1, 9, 4])
|
|
|
|
endfunction
|
|
|
|
|
2013-10-28 13:53:33 +02:00
|
|
|
function! SyntaxCheckers_haskell_hlint_GetLocList() dict
|
2017-02-15 08:48:45 +02:00
|
|
|
let buf = bufnr('')
|
2014-04-05 15:47:20 +02:00
|
|
|
let makeprg = self.makeprgBuild({
|
2019-03-07 20:02:16 +02:00
|
|
|
\ 'args_before': '--color=never',
|
2017-02-15 08:48:45 +02:00
|
|
|
\ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) })
|
2013-07-29 12:52:22 +01:00
|
|
|
|
2013-08-12 22:46:20 +03:00
|
|
|
let errorformat =
|
2015-09-15 22:23:22 +03:00
|
|
|
\ '%E%f:%l:%v: Error while reading hint file\, %m,' .
|
2014-04-10 09:00:13 +03:00
|
|
|
\ '%E%f:%l:%v: Error: %m,' .
|
|
|
|
\ '%W%f:%l:%v: Warning: %m,' .
|
2016-02-28 01:27:07 -05:00
|
|
|
\ '%W%f:%l:%v: Suggestion: %m,' .
|
2013-08-12 22:46:20 +03:00
|
|
|
\ '%C%m'
|
|
|
|
|
|
|
|
return SyntasticMake({
|
2013-07-29 12:52:22 +01:00
|
|
|
\ 'makeprg': makeprg,
|
2013-07-29 16:14:36 +01:00
|
|
|
\ 'errorformat': errorformat,
|
2014-04-10 09:00:13 +03:00
|
|
|
\ 'defaults': {'vcol': 1},
|
2013-07-29 16:14:36 +01:00
|
|
|
\ 'postprocess': ['compressWhitespace'] })
|
2013-07-29 12:52:22 +01:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
|
|
\ 'filetype': 'haskell',
|
|
|
|
\ 'name': 'hlint'})
|
2014-01-03 11:29:08 +02:00
|
|
|
|
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
|
|
|
|
2015-01-04 12:46:54 +02:00
|
|
|
" vim: set sw=4 sts=4 et fdm=marker:
|