From 7fedd203e716c170efcf0c43a7e35406edef4aad Mon Sep 17 00:00:00 2001 From: AD7six Date: Wed, 25 Jan 2012 12:28:54 +0100 Subject: [PATCH] only run phpcs if the file has no syntax errors. running phpcs on a file which contains a parse error generates a huge number of warnings from the phpcs library. This can freeze vim for minutes at a time while it attempts to parse these notices/warnings/errors. Therefore - don't run phpcs on files which have parse errors. --- syntax_checkers/php.vim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/syntax_checkers/php.vim b/syntax_checkers/php.vim index d48b8e82..d3e52de3 100644 --- a/syntax_checkers/php.vim +++ b/syntax_checkers/php.vim @@ -37,13 +37,14 @@ endfunction function! SyntaxCheckers_php_GetLocList() let errors = [] - if !g:syntastic_phpcs_disable && executable("phpcs") - let errors = s:GetPHPCSErrors() - endif let makeprg = "php -l ".shellescape(expand('%')) let errorformat='%-GNo syntax errors detected in%.%#,PHP Parse error: %#syntax %trror\, %m in %f on line %l,PHP Fatal %trror: %m in %f on line %l,%-GErrors parsing %.%#,%-G\s%#,Parse error: %#syntax %trror\, %m in %f on line %l,Fatal %trror: %m in %f on line %l' - let errors = errors + SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + if empty(errors) && !g:syntastic_phpcs_disable && executable("phpcs") + let errors = errors + s:GetPHPCSErrors() + endif call SyntasticHighlightErrors(errors, function('SyntaxCheckers_php_Term'))