28bce98a68
Make SyntaxCheckers_*_GetLocList() dictionary functions. Pass a reference to the current checker to syntastic#makeprg#build(). Add an optional 'redirect' argument to CreateAndRegisterChecker(). Change the sh checker to use the new dictionary functions. Add a new registry method getLocListRaw() (needed for the sh checker).
43 lines
1.3 KiB
VimL
43 lines
1.3 KiB
VimL
"============================================================================
|
|
"File: python.vim
|
|
"Description: Syntax checking plugin for syntastic.vim
|
|
"Author: Artem Nezvigin <artem at artnez dot com>
|
|
"
|
|
" `errorformat` derived from:
|
|
" http://www.vim.org/scripts/download_script.php?src_id=1392
|
|
"
|
|
"============================================================================
|
|
if exists("g:loaded_syntastic_python_python_checker")
|
|
finish
|
|
endif
|
|
let g:loaded_syntastic_python_python_checker=1
|
|
|
|
function! SyntaxCheckers_python_python_IsAvailable()
|
|
return executable('python')
|
|
endfunction
|
|
|
|
function! SyntaxCheckers_python_python_GetLocList() dict
|
|
let fname = "'" . escape(expand('%'), "\\'") . "'"
|
|
|
|
let makeprg = syntastic#makeprg#build({
|
|
\ 'exe': 'python',
|
|
\ 'args': '-c',
|
|
\ 'fname': syntastic#util#shescape("compile(open(" . fname . ").read(), " . fname . ", 'exec')"),
|
|
\ 'checker': self })
|
|
|
|
let errorformat =
|
|
\ '%E File "%f"\, line %l,' .
|
|
\ '%C %p^,' .
|
|
\ '%C %.%#,' .
|
|
\ '%Z%m,' .
|
|
\ '%-G%.%#'
|
|
|
|
return SyntasticMake({
|
|
\ 'makeprg': makeprg,
|
|
\ 'errorformat': errorformat })
|
|
endfunction
|
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
\ 'filetype': 'python',
|
|
\ 'name': 'python'})
|