forked from VimPlug/jedi-vim
Add JediDebugInfo command: display used Python version
This command is meant to come in handy to debug problems with jedi-vim. For now, it will display the Python version that jedi-vim is using.
This commit is contained in:
@@ -118,13 +118,16 @@ function! jedi#init_python()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
let s:python_version = 'null'
|
||||||
function! jedi#setup_py_version(py_version)
|
function! jedi#setup_py_version(py_version)
|
||||||
if a:py_version == 2
|
if a:py_version == 2
|
||||||
let cmd_init = 'pyfile'
|
let cmd_init = 'pyfile'
|
||||||
let cmd_exec = 'python'
|
let cmd_exec = 'python'
|
||||||
|
let s:python_version = 2
|
||||||
elseif a:py_version == 3
|
elseif a:py_version == 3
|
||||||
let cmd_init = 'py3file'
|
let cmd_init = 'py3file'
|
||||||
let cmd_exec = 'python3'
|
let cmd_exec = 'python3'
|
||||||
|
let s:python_version = 3
|
||||||
else
|
else
|
||||||
throw "jedi#setup_py_version: invalid py_version: ".a:py_version
|
throw "jedi#setup_py_version: invalid py_version: ".a:py_version
|
||||||
endif
|
endif
|
||||||
@@ -139,6 +142,11 @@ function! jedi#setup_py_version(py_version)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! jedi#debug_info()
|
||||||
|
echom "Using Python version:" s:python_version
|
||||||
|
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
|
||||||
return jedi#setup_py_version(a:py_version)
|
return jedi#setup_py_version(a:py_version)
|
||||||
|
|||||||
@@ -30,4 +30,6 @@ endif
|
|||||||
" Pyimport command
|
" Pyimport command
|
||||||
command! -nargs=1 -complete=custom,jedi#py_import_completions Pyimport :call jedi#py_import(<q-args>)
|
command! -nargs=1 -complete=custom,jedi#py_import_completions Pyimport :call jedi#py_import(<q-args>)
|
||||||
|
|
||||||
|
command! -nargs=0 JediDebugInfo call jedi#debug_info()
|
||||||
|
|
||||||
" vim: set et ts=4:
|
" vim: set et ts=4:
|
||||||
|
|||||||
Reference in New Issue
Block a user