forked from VimPlug/jedi-vim
Drop jedi#get_force_py_version again, handle 'auto' once
This commit is contained in:
@@ -337,38 +337,38 @@ call s:init()
|
|||||||
|
|
||||||
let s:script_path = fnameescape(expand('<sfile>:p:h:h'))
|
let s:script_path = fnameescape(expand('<sfile>:p:h:h'))
|
||||||
|
|
||||||
" Get g:jedi#force_py_version, handling "auto" on first call.
|
if g:jedi#force_py_version == 'auto'
|
||||||
function! jedi#get_force_py_version()
|
" Get default python version from interpreter in $PATH.
|
||||||
if g:jedi#force_py_version == 'auto'
|
let s:def_py = system("python -c 'import sys; sys.stdout.write(str(sys.version_info[0]))'")
|
||||||
let s:def_py = system("python -c 'import sys; sys.stdout.write(str(sys.version_info[0]))'")
|
if v:shell_error == 0 && len(s:def_py)
|
||||||
if v:shell_error == 0 && len(s:def_py)
|
let g:jedi#force_py_version = s:def_py
|
||||||
let g:jedi#force_py_version = s:def_py
|
else
|
||||||
else
|
if !exists("g:jedi#squelch_py_warning")
|
||||||
if !exists("g:jedi#squelch_py_warning")
|
echomsg "Error: jedi-vim failed to get Python version from sys.version_info: " . s:def_py
|
||||||
echomsg "Error: jedi-vim failed to get Python version from sys.version_info: " . s:def_py
|
echomsg "Falling back to version 2."
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
let g:jedi#force_py_version = 2
|
||||||
endif
|
endif
|
||||||
return g:jedi#force_py_version
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" NOTE: nvim usually has both python providers. Skipping the `has` check
|
if has('nvim') || (has('python') && has('python3'))
|
||||||
" avoids starting both of them.
|
" Neovim usually has both python providers. Skipping the `has` check
|
||||||
if has('nvim') || (has('python') && has('python3'))
|
" avoids starting both of them.
|
||||||
" Use default python with Jedi.
|
call jedi#force_py_version(g:jedi#force_py_version)
|
||||||
call jedi#force_py_version(jedi#get_force_py_version())
|
elseif has('python')
|
||||||
elseif has('python')
|
command! -nargs=1 Python python <args>
|
||||||
command! -nargs=1 Python python <args>
|
execute 'pyfile '.s:script_path.'/initialize.py'
|
||||||
execute 'pyfile '.s:script_path.'/initialize.py'
|
elseif has('python3')
|
||||||
elseif has('python3')
|
command! -nargs=1 Python python3 <args>
|
||||||
command! -nargs=1 Python python3 <args>
|
execute 'py3file '.s:script_path.'/initialize.py'
|
||||||
execute 'py3file '.s:script_path.'/initialize.py'
|
else
|
||||||
|
if !exists("g:jedi#squelch_py_warning")
|
||||||
|
echomsg "Error: jedi-vim requires vim compiled with +python"
|
||||||
|
endif
|
||||||
|
finish
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if !exists("g:jedi#squelch_py_warning")
|
call jedi#force_py_version(g:jedi#force_py_version)
|
||||||
echomsg "Error: jedi-vim requires vim compiled with +python"
|
end
|
||||||
endif
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
"Python jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout, speed=True, warnings=False, notices=False)
|
"Python jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout, speed=True, warnings=False, notices=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user