Skip to content

Commit

Permalink
less checker: convert it to use errorformat/makeprg
Browse files Browse the repository at this point in the history
this way we can add new expressions to errorformat to upgrade to
the latest lessc output while preserving backwards compatibility
  • Loading branch information
scrooloose committed Feb 13, 2011
1 parent e2f8d56 commit 5dfedf9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions syntax_checkers/less.vim
Expand Up @@ -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

0 comments on commit 5dfedf9

Please sign in to comment.