mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-06 10:54:22 +08:00
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
|
||||
|
||||
|
||||
def _get_environment():
|
||||
def get_environment():
|
||||
global last_force_python_error
|
||||
|
||||
force_python_version = vim_eval("g:jedi#force_py_version")
|
||||
@@ -204,7 +204,7 @@ def get_script(source=None, column=None):
|
||||
return jedi.Script(
|
||||
source, row, column, buf_path,
|
||||
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'))
|
||||
import_path = args.pop()
|
||||
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:
|
||||
completion = scr.goto_assignments()[0]
|
||||
except IndexError:
|
||||
@@ -693,7 +693,7 @@ def py_import_completions():
|
||||
comps = []
|
||||
else:
|
||||
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()]
|
||||
vim.command("return '%s'" % '\n'.join(comps))
|
||||
|
||||
|
||||
@@ -34,9 +34,12 @@ def display_debug_info():
|
||||
|
||||
script_evaluator = jedi_vim.jedi.Script('')._evaluator
|
||||
try:
|
||||
sys_path = script_evaluator.project.sys_path
|
||||
except AttributeError:
|
||||
sys_path = script_evaluator.sys_path
|
||||
sys_path = jedi_vim.get_environment().get_sys_path()
|
||||
except:
|
||||
try:
|
||||
sys_path = script_evaluator.project.sys_path
|
||||
except AttributeError:
|
||||
sys_path = script_evaluator.sys_path
|
||||
for p in sys_path:
|
||||
echo("printf(' - `%s`', {0!r})".format(p))
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user