forked from VimPlug/jedi-vim
Fix the jedi-vim debug tool, fixes #795
This commit is contained in:
@@ -160,7 +160,7 @@ def _check_jedi_availability(show_error=False):
|
|||||||
last_force_python_error = None
|
last_force_python_error = None
|
||||||
|
|
||||||
|
|
||||||
def _get_environment():
|
def get_environment():
|
||||||
global last_force_python_error
|
global last_force_python_error
|
||||||
|
|
||||||
force_python_version = vim_eval("g:jedi#force_py_version")
|
force_python_version = vim_eval("g:jedi#force_py_version")
|
||||||
@@ -204,7 +204,7 @@ def get_script(source=None, column=None):
|
|||||||
return jedi.Script(
|
return jedi.Script(
|
||||||
source, row, column, buf_path,
|
source, row, column, buf_path,
|
||||||
encoding=vim_eval('&encoding') or 'latin1',
|
encoding=vim_eval('&encoding') or 'latin1',
|
||||||
environment=_get_environment(),
|
environment=get_environment(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -670,7 +670,7 @@ def py_import():
|
|||||||
args = shsplit(vim.eval('a:args'))
|
args = shsplit(vim.eval('a:args'))
|
||||||
import_path = args.pop()
|
import_path = args.pop()
|
||||||
text = 'import %s' % import_path
|
text = 'import %s' % import_path
|
||||||
scr = jedi.Script(text, 1, len(text), '', environment=_get_environment())
|
scr = jedi.Script(text, 1, len(text), '', environment=get_environment())
|
||||||
try:
|
try:
|
||||||
completion = scr.goto_assignments()[0]
|
completion = scr.goto_assignments()[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
@@ -693,7 +693,7 @@ def py_import_completions():
|
|||||||
comps = []
|
comps = []
|
||||||
else:
|
else:
|
||||||
text = 'import %s' % argl
|
text = 'import %s' % argl
|
||||||
script = jedi.Script(text, 1, len(text), '', environment=_get_environment())
|
script = jedi.Script(text, 1, len(text), '', environment=get_environment())
|
||||||
comps = ['%s%s' % (argl, c.complete) for c in script.completions()]
|
comps = ['%s%s' % (argl, c.complete) for c in script.completions()]
|
||||||
vim.command("return '%s'" % '\n'.join(comps))
|
vim.command("return '%s'" % '\n'.join(comps))
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ def display_debug_info():
|
|||||||
echo("' - sys_path:'")
|
echo("' - sys_path:'")
|
||||||
|
|
||||||
script_evaluator = jedi_vim.jedi.Script('')._evaluator
|
script_evaluator = jedi_vim.jedi.Script('')._evaluator
|
||||||
|
try:
|
||||||
|
sys_path = jedi_vim.get_environment().get_sys_path()
|
||||||
|
except:
|
||||||
try:
|
try:
|
||||||
sys_path = script_evaluator.project.sys_path
|
sys_path = script_evaluator.project.sys_path
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|||||||
Reference in New Issue
Block a user