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 diff --git a/syntax_checkers/less.vim b/syntax_checkers/less.vim index ef6d3c7e..912b5625 100644 --- a/syntax_checkers/less.vim +++ b/syntax_checkers/less.vim @@ -20,13 +20,17 @@ 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,! 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 +endfunction