forked from VimPlug/jedi-vim
jedi#force_py_version: catch errors
This prevents the script from aborting, in case e.g. `py3file` is not defined, but should be forced.
This commit is contained in:
@@ -256,13 +256,19 @@ endfunction
|
|||||||
|
|
||||||
function! jedi#force_py_version(py_version)
|
function! jedi#force_py_version(py_version)
|
||||||
let g:jedi#force_py_version = a:py_version
|
let g:jedi#force_py_version = a:py_version
|
||||||
if g:jedi#force_py_version == 2
|
try
|
||||||
command! -nargs=1 Python python <args>
|
if g:jedi#force_py_version == 2
|
||||||
execute 'pyfile '.s:script_path.'/initialize.py'
|
command! -nargs=1 Python python <args>
|
||||||
elseif g:jedi#force_py_version == 3
|
execute 'pyfile '.s:script_path.'/initialize.py'
|
||||||
command! -nargs=1 Python python3 <args>
|
elseif g:jedi#force_py_version == 3
|
||||||
execute 'py3file '.s:script_path.'/initialize.py'
|
command! -nargs=1 Python python3 <args>
|
||||||
endif
|
execute 'py3file '.s:script_path.'/initialize.py'
|
||||||
|
endif
|
||||||
|
catch
|
||||||
|
if !exists("g:jedi#squelch_py_warning")
|
||||||
|
echom "jedi#force_py_version failed: " . v:exception
|
||||||
|
endif
|
||||||
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user