Merge remote-tracking branch 'scrooloose/master'

This commit is contained in:
Chris Hoffman 2011-02-13 01:20:09 -06:00
commit 09eb954a44
2 changed files with 14 additions and 10 deletions

View File

@ -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

View File

@ -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