slim: errorformat includes column if slimrb --version > 1.3.0

This commit is contained in:
Richard Brown 2012-09-22 20:00:12 +01:00
parent 87f10e54d4
commit d2d8bb926d

View File

@ -19,8 +19,23 @@ if !executable("slimrb")
finish
endif
function! s:SlimrbVersion()
if !exists('s:slimrb_version')
let output = system("slimrb --version 2>/dev/null")
let output = substitute(output, '\n$', '', '')
let output = substitute(output, '^slim ', '', 'i')
let s:slimrb_version = split(output, '\.')
end
return s:slimrb_version
endfunction
function! SyntaxCheckers_slim_GetLocList()
let makeprg = "slimrb -c " . shellescape(expand("%"))
let errorformat = '%C\ %#%f\, Line %l,%-G\ %.%#,%ESlim::Parser::SyntaxError: %m,%+C%.%#'
if SyntasticIsVersionAtLeast(s:SlimrbVersion(), [1,3,1])
let errorformat = '%C\ %#%f\, Line %l\, Column %c,%-G\ %.%#,%ESlim::Parser::SyntaxError: %m,%+C%.%#'
else
let errorformat = '%C\ %#%f\, Line %l,%-G\ %.%#,%ESlim::Parser::SyntaxError: %m,%+C%.%#'
endif
echo errorformat
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction