forked from VimPlug/jedi-vim
Merge pull request #602 from blueyed/improve-jedi-load-error
Improve error msg when the jedi submodule fails to load
This commit is contained in:
43
README.rst
43
README.rst
@@ -68,28 +68,47 @@ Apart from that, jedi-vim supports the following commands
|
|||||||
Installation
|
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 <https://github.com/tpope/vim-pathogen>`_ or
|
You might want to use `pathogen <https://github.com/tpope/vim-pathogen>`_ or
|
||||||
`vundle <https://github.com/gmarik/vundle>`_ to install jedi in VIM. Also you
|
`Vundle <https://github.com/gmarik/vundle>`_ to install jedi-vim.
|
||||||
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`` )
|
|
||||||
|
|
||||||
The first thing you need after that is an up-to-date version of Jedi. You can
|
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``
|
either install it via ``pip install jedi`` or with
|
||||||
in your jedi-vim repository.
|
``git submodule update --init`` in your jedi-vim repository.
|
||||||
|
|
||||||
Example Installation Command using Pathogen:
|
Example installation command using Pathogen:
|
||||||
|
|
||||||
.. code-block:: sh
|
.. code-block:: sh
|
||||||
|
|
||||||
cd ~/.vim/bundle/ && git clone --recursive https://github.com/davidhalter/jedi-vim.git
|
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
|
Installation with your distribution
|
||||||
<https://www.archlinux.org/packages/community/any/vim-jedi/>`__. It is also available
|
-----------------------------------
|
||||||
on `Debian (≥8) <https://packages.debian.org/vim-python-jedi>`__ and `Ubuntu (≥14.04)
|
|
||||||
<http://packages.ubuntu.com/vim-python-jedi>`__ as vim-python-jedi. On Fedora Linux,
|
On Arch Linux, you can also install jedi-vim from official repositories as
|
||||||
it is available as `vim-jedi <https://apps.fedoraproject.org/packages/vim-jedi>`__.
|
`vim-jedi <https://www.archlinux.org/packages/community/any/vim-jedi/>`__.
|
||||||
|
It is also available on
|
||||||
|
`Debian (≥8) <https://packages.debian.org/vim-python-jedi>`__ and
|
||||||
|
`Ubuntu (≥14.04) <http://packages.ubuntu.com/vim-python-jedi>`__ as
|
||||||
|
vim-python-jedi.
|
||||||
|
On Fedora Linux, it is available as
|
||||||
|
`vim-jedi <https://apps.fedoraproject.org/packages/vim-jedi>`__.
|
||||||
|
|
||||||
|
Please note that this version might be quite old compared to using jedi-vim
|
||||||
|
from Git.
|
||||||
|
|
||||||
|
Caveats
|
||||||
|
-------
|
||||||
|
|
||||||
Note that the `python-mode <https://github.com/klen/python-mode>`_ VIM plugin seems
|
Note that the `python-mode <https://github.com/klen/python-mode>`_ VIM plugin seems
|
||||||
to conflict with jedi-vim, therefore you should disable it before enabling
|
to conflict with jedi-vim, therefore you should disable it before enabling
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ def no_jedi_warning(error=None):
|
|||||||
|
|
||||||
|
|
||||||
def echo_highlight(msg):
|
def echo_highlight(msg):
|
||||||
vim_command('echohl WarningMsg | echom "{0}" | echohl None'.format(
|
vim_command('echohl WarningMsg | echom "jedi-vim: {0}" | echohl None'.format(
|
||||||
msg.replace('"', '\\"')))
|
str(msg).replace('"', '\\"')))
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -102,7 +102,10 @@ else:
|
|||||||
try:
|
try:
|
||||||
version = jedi.__version__
|
version = jedi.__version__
|
||||||
except Exception as e: # e.g. AttributeError
|
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
|
jedi = None
|
||||||
else:
|
else:
|
||||||
if isinstance(version, str):
|
if isinstance(version, str):
|
||||||
|
|||||||
Reference in New Issue
Block a user