From 3882c5dd326d22bc513550bea205d450b315621d Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 3 Aug 2016 11:08:30 +0200 Subject: [PATCH 1/3] Improve error message when the jedi module fails to load Fixes https://github.com/davidhalter/jedi-vim/issues/560. --- jedi_vim.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jedi_vim.py b/jedi_vim.py index 1bbba46..c2cbfc6 100644 --- a/jedi_vim.py +++ b/jedi_vim.py @@ -100,7 +100,10 @@ else: try: version = jedi.__version__ except Exception as e: # e.g. AttributeError - echo_highlight("Could not load jedi python module: {0}".format(e)) + echo_highlight( + "Error when loading the jedi python module ({0}). " + "Please ensure that Jedi is installed correctly (see Installation " + "in the README.".format(e)) jedi = None else: if isinstance(version, str): From 369284a6bccb5f4e258fde220cecb66b7968d490 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 3 Aug 2016 11:18:41 +0200 Subject: [PATCH 2/3] README: enhance Installation section --- README.rst | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/README.rst b/README.rst index 2a2cf16..5f1f121 100644 --- a/README.rst +++ b/README.rst @@ -68,28 +68,47 @@ Apart from that, jedi-vim supports the following commands Installation ============ +Requirements +------------ +You need a VIM version that was compiled with Python 2.6 or later +(``+python`` or ``+python3``), which is typical for most distributions on +Linux. You can check this from within VIM using +``:python3 import sys; print sys.version`` (use ``:python`` for Python 2). + +Manual installation +------------------- + You might want to use `pathogen `_ or -`vundle `_ to install jedi in VIM. Also you -need a VIM version that was compiled with ``+python``, which is typical for most -distributions on Linux. The Python version compiled into VIM must be 2.6 or later -(you can check this from within VIM using ``:python import sys; print sys.version`` ) +`Vundle `_ to install jedi-vim. The first thing you need after that is an up-to-date version of Jedi. You can -either get it via ``pip install jedi`` or with ``git submodule update --init`` -in your jedi-vim repository. +either install it via ``pip install jedi`` or with +``git submodule update --init`` in your jedi-vim repository. -Example Installation Command using Pathogen: +Example installation command using Pathogen: .. code-block:: sh cd ~/.vim/bundle/ && git clone --recursive https://github.com/davidhalter/jedi-vim.git -On Arch Linux, you can also install jedi-vim from official repositories as `vim-jedi -`__. It is also available -on `Debian (≥8) `__ and `Ubuntu (≥14.04) -`__ as vim-python-jedi. On Fedora Linux, -it is available as `vim-jedi `__. +Installation with your distribution +----------------------------------- + +On Arch Linux, you can also install jedi-vim from official repositories as +`vim-jedi `__. +It is also available on +`Debian (≥8) `__ and +`Ubuntu (≥14.04) `__ as +vim-python-jedi. +On Fedora Linux, it is available as +`vim-jedi `__. + +Please note that this version might be quite old compared to using jedi-vim +from Git. + +Caveats +------- Note that the `python-mode `_ VIM plugin seems to conflict with jedi-vim, therefore you should disable it before enabling From ba0b44b65d6092f9094830b6eab510f07dcdca4b Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 3 Aug 2016 11:19:09 +0200 Subject: [PATCH 3/3] echo_highlight: cast msg to str This helps to avoid errors with incomplete traceback/exception details when using it with e.g. `echo_highlight(dir(jedi))`. --- jedi_vim.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jedi_vim.py b/jedi_vim.py index c2cbfc6..3fbb80b 100644 --- a/jedi_vim.py +++ b/jedi_vim.py @@ -87,8 +87,8 @@ def no_jedi_warning(error=None): def echo_highlight(msg): - vim_command('echohl WarningMsg | echom "{0}" | echohl None'.format( - msg.replace('"', '\\"'))) + vim_command('echohl WarningMsg | echom "jedi-vim: {0}" | echohl None'.format( + str(msg).replace('"', '\\"'))) try: