From 714392db167e019866a7146581314b63e9b7a275 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Mon, 4 Jul 2011 23:48:26 +1200 Subject: [PATCH 1/3] only load syntax checker plugins when needed This reduces the number of unnecessary files that get sourced. --- plugin/syntastic.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b23d2dcc..03a50ac8 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -47,9 +47,6 @@ if !exists("g:syntastic_stl_format") let g:syntastic_stl_format = '[Syntax: line:%F (%t)]' endif -"load all the syntax checkers -runtime! syntax_checkers/*.vim - "refresh and redraw all the error info for this buf when saving or reading autocmd bufreadpost,bufwritepost * call s:UpdateErrors() function! s:UpdateErrors() @@ -289,6 +286,10 @@ function! SyntasticMake(options) endfunction function! s:Checkable(ft) + if !exists("g:loaded_" . a:ft . "_syntax_checker") + exec "runtime syntax_checkers/" . a:ft . ".vim" + endif + return exists("*SyntaxCheckers_". a:ft ."_GetLocList") && \ index(g:syntastic_disabled_filetypes, a:ft) == -1 endfunction From a93acbd94000012e532e9ad51279633d555a8aad Mon Sep 17 00:00:00 2001 From: Roman Gonzalez Date: Wed, 6 Jul 2011 18:30:19 -0700 Subject: [PATCH 2/3] Adding ghc-mod as the haskell syntax checker Previously ghc was being used, but this was not good because ghc would work only on individual files. As soon you included an external module also developed on the current project, ghc would barf at you saying that the module couldn't be found. ghc-mod doesn't check dependencies, just syntax, also it has the lint utility that is pretty handy. --- syntax_checkers/haskell.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/syntax_checkers/haskell.vim b/syntax_checkers/haskell.vim index 9546d6cd..bf98fe7b 100644 --- a/syntax_checkers/haskell.vim +++ b/syntax_checkers/haskell.vim @@ -14,15 +14,15 @@ if exists("loaded_haskell_syntax_checker") endif let loaded_haskell_syntax_checker = 1 -"bail if the user doesnt have ghc installed -if !executable("ghc") +"bail if the user doesnt have ghc-mod installed +if !executable("ghc-mod") finish endif -" As this calls ghc, it can take a few seconds... maybe hlint or something -" could do a good enough job? function! SyntaxCheckers_haskell_GetLocList() - let makeprg = 'ghc '.shellescape(expand('%')).' -e :q' + let makeprg = + \ 'ghc-mod check '. shellescape(expand('%')) . + \ ' && ghc-mod lint ' . shellescape(expand('%')) let errorformat = '%-G\\s%#,%f:%l:%c:%m,%E%f:%l:%c:,%Z%m,' From 17183c6d19b7d1ced18e18187eeb2fa148f1a29e Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sat, 9 Jul 2011 18:59:21 +1200 Subject: [PATCH 3/3] fix the haml syntax checker some ruby warnings were getting output when "haml -c" was run - these were not getting handled by the syntax checker use SyntasticMake instead of custom hax0r to parse the errors - this way it is trivial to ignore all output that we dont care about --- syntax_checkers/haml.vim | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/syntax_checkers/haml.vim b/syntax_checkers/haml.vim index 4d2801fe..b9ad6ad1 100644 --- a/syntax_checkers/haml.vim +++ b/syntax_checkers/haml.vim @@ -20,12 +20,7 @@ if !executable("haml") endif function! SyntaxCheckers_haml_GetLocList() - let output = system("haml -c " . shellescape(expand("%"))) - if v:shell_error != 0 - "haml only outputs the first error, so parse it ourselves - let line = substitute(output, '^\%(Syntax\|Haml\) error on line \(\d*\):.*', '\1', '') - let msg = substitute(output, '^\%(Syntax\|Haml\) error on line \d*:\(.*\)', '\1', '') - return [{'lnum' : line, 'text' : msg, 'bufnr': bufnr(""), 'type': 'E' }] - endif - return [] + let makeprg = "haml -c " . shellescape(expand("%")) + let errorformat = 'Haml error on line %l: %m,Syntax error on line %l: %m,%-G%.%#' + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction