Files
jedi-vim-fork/pythonx/jedi_vim_debug.py
naronA 0b9bbc3495 fix: CheckHealth doesn't work in neovim (#765)
Squashed:

* fix: CheckHealth doesn't work in neovim

CheckHealth calls display_debug_info().
However, error occured when loading jedi_vim.jedi.Script('')._evaluator.sys_path,
because Evaluator.sys_path is unavailable variable.

* handle the both the old and new API

Evaluator.project.sys_path is temporary fix, because Evaluator.sys_path is correct API.
So, we handle the both the old and new API in preparation for merging virtualenv branch.
2017-12-30 14:03:54 +01:00

45 lines
1.5 KiB
Python

"""Used in jedi-vim's jedi#debug_info()"""
def display_debug_info():
import vim
def echo(msg):
vim.command('echo {0}'.format(msg))
echo("printf(' - sys.version: `%s`', {0!r})".format(
', '.join([x.strip()
for x in __import__('sys').version.split('\n')])))
echo("printf(' - site module: `%s`', {0!r})".format(
__import__('site').__file__))
try:
import jedi_vim
except Exception as e:
echo("printf('ERROR: jedi_vim is not available: %s: %s', "
"{0!r}, {1!r})".format(e.__class__.__name__, str(e)))
return
try:
if jedi_vim.jedi is None:
echo("'ERROR: could not import the \"jedi\" Python module.'")
echo("printf(' The error was: %s', {0!r})".format(
getattr(jedi_vim, "jedi_import_error", "UNKNOWN")))
else:
echo("printf('Jedi path: `%s`', {0!r})".format(
jedi_vim.jedi.__file__))
echo("printf(' - version: %s', {0!r})".format(
jedi_vim.jedi.__version__))
echo("' - sys_path:'")
script_evaluator = jedi_vim.jedi.Script('')._evaluator
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:
echo("printf('There was an error accessing jedi_vim.jedi: %s', "
"{0!r})".format(e))