Cygwin support added.
This commit is contained in:
parent
8217787543
commit
2f89733f3e
@ -27,19 +27,44 @@ function! SyntaxCheckers_java_checkstyle_IsAvailable()
|
|||||||
return executable('java')
|
return executable('java')
|
||||||
endfunction
|
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()
|
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({
|
let makeprg = syntastic#makeprg#build({
|
||||||
\ 'exe': 'java',
|
\ 'exe': 'java',
|
||||||
\ 'args': '-cp ' . g:syntastic_java_checkstyle_classpath . ' com.puppycrawl.tools.checkstyle.Main -c ' . g:syntastic_java_checkstyle_conf_file,
|
\ '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',
|
\ 'tail': '2>&1',
|
||||||
\ 'subchecker': 'checkstyle' })
|
\ 'subchecker': 'checkstyle' })
|
||||||
|
|
||||||
" check style format
|
" check style format
|
||||||
let errorformat = '%f:%l:%c:\ %m,%f:%l:\ %m'
|
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
|
endfunction
|
||||||
|
|
||||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user