Cygwin support added.
This commit is contained in:
parent
8217787543
commit
2f89733f3e
@ -27,19 +27,44 @@ function! SyntaxCheckers_java_checkstyle_IsAvailable()
|
||||
return executable('java')
|
||||
endfunction
|
||||
|
||||
function! s:CygwinPath(path)
|
||||
return substitute(system("cygpath -m ".a:path), '\%x00', '', 'g')
|
||||
endfunction
|
||||
|
||||
function! s:RemoveCarriageReturn(line)
|
||||
return substitute(a:line, '\r', '', 'g')
|
||||
endfunction
|
||||
|
||||
function! s:RemoveCarriageReturns(errors)
|
||||
for error in a:errors
|
||||
let error['text'] = s:RemoveCarriageReturn(error['text'])
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_java_checkstyle_GetLocList()
|
||||
|
||||
let fname = fnameescape(expand ( '%:p:h' ) . '/' . expand ( '%:t' ))
|
||||
|
||||
if has('win32unix')
|
||||
let fname = s:CygwinPath(fname)
|
||||
endif
|
||||
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': 'java',
|
||||
\ 'args': '-cp ' . g:syntastic_java_checkstyle_classpath . ' com.puppycrawl.tools.checkstyle.Main -c ' . g:syntastic_java_checkstyle_conf_file,
|
||||
\ 'fname': expand ( '%:p:h' ) . '/' . expand ( '%:t' ),
|
||||
\ 'fname': fname,
|
||||
\ 'tail': '2>&1',
|
||||
\ 'subchecker': 'checkstyle' })
|
||||
|
||||
" check style format
|
||||
let errorformat = '%f:%l:%c:\ %m,%f:%l:\ %m'
|
||||
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
if has('win32unix')
|
||||
call s:RemoveCarriageReturns(errors)
|
||||
endif
|
||||
|
||||
return errors
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
Loading…
x
Reference in New Issue
Block a user