From e2f8d56bc4ddf514641cec0187be73bc3339e728 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sat, 12 Feb 2011 01:15:00 +1300 Subject: [PATCH 1/3] fix a bug with s:ErrorsForType() compare the error type case insensitively since we cant know whether errors will have a type of 'E' or 'e' --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index cf4821b9..d66339d8 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -106,7 +106,7 @@ function! s:ErrorsForType(type) if !exists("b:syntastic_loclist") return [] endif - return filter(copy(b:syntastic_loclist), 'v:val["type"] ==# "' . a:type . '"') + return filter(copy(b:syntastic_loclist), 'v:val["type"] ==? "' . a:type . '"') endfunction if g:syntastic_enable_signs From 5dfedf994fc5ff6fdf2ad44dac1fcd2df84f6d58 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sat, 12 Feb 2011 18:51:03 +1300 Subject: [PATCH 2/3] less checker: convert it to use errorformat/makeprg this way we can add new expressions to errorformat to upgrade to the latest lessc output while preserving backwards compatibility --- syntax_checkers/less.vim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/syntax_checkers/less.vim b/syntax_checkers/less.vim index ef6d3c7e..02684b60 100644 --- a/syntax_checkers/less.vim +++ b/syntax_checkers/less.vim @@ -20,13 +20,13 @@ if !executable("lessc") endif function! SyntaxCheckers_less_GetLocList() - let output = system("lessc " . shellescape(expand("%"))) - if v:shell_error != 0 - "less only outputs the first error, so parse it ourselves - let line = substitute(output, '^! Syntax Error: on line \(\d*\):.*$', '\1', '') - let msg = substitute(output, '^! Syntax Error: on line \d*:\(.*\)$', '\1', '') - return [{'lnum' : line, 'text' : msg, 'bufnr': bufnr(""), 'type': 'E' }] - endif - return [] -endfunction + let makeprg = 'lessc '. shellescape(expand('%')) + let errorformat = '! Syntax %trror: on line %l: %m,%-G%.%#' + let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + for i in errors + let i['bufnr'] = bufnr("") + endfor + + return errors +endfunction From db90009a119550a3b519e4218ea9b76b37d3952f Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sun, 13 Feb 2011 14:07:42 +1300 Subject: [PATCH 3/3] less checker: make it handle the new lessc output as well --- syntax_checkers/less.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/less.vim b/syntax_checkers/less.vim index 02684b60..912b5625 100644 --- a/syntax_checkers/less.vim +++ b/syntax_checkers/less.vim @@ -21,11 +21,15 @@ endif function! SyntaxCheckers_less_GetLocList() let makeprg = 'lessc '. shellescape(expand('%')) - let errorformat = '! Syntax %trror: on line %l: %m,%-G%.%#' + let errorformat = 'Syntax %trror on line %l,! Syntax %trror: on line %l: %m,%-G%.%#' let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) for i in errors let i['bufnr'] = bufnr("") + + if empty(i['text']) + let i['text'] = "Syntax error" + endif endfor return errors