forked from VimPlug/jedi-vim
2a43448f3bbcd4fed07db2c223f054e6e4b1a4ec
* pythonx/jedi a79a1fb...bd1010b (91):
> Create a new 0.13.1 release
> Fixed completions of global vars and tensorflow slowness, fixes #1228, #1116
> The changelog date was wrong
> Release notes for 0.13.0
> Fix tensorflow issues with a few hacks (temporary), fixes #1195
> If the VIRTUAL_ENV variable changes, need to reload the default environment, fixes #1201, #1200
> Return SameEnvironment as a default, fixes #1226, #1196
> Document that using the REPL autocompletion is only available on Linux/Mac, fixes #1184
> Fix an issue with f-strings, fixes #1224
> Ignore some errors that are happening when the Python process ends and its subprocesses are cleaned up
> also remove crashes with pep 448 unpacking of lists and sets
> Fixed crash (and now recognises correctly) {**d, "b": "b"}["b"]
> Recognize {**d} as a dict instead of set
> Add extras_require=testing
> _get_virtual_env_from_var: use safe=False
> tests: venv_path: use session scope
> jedi/api/environment.py: minor flake8 fix
> jedi.api.environment._SUPPORTED_PYTHONS: add 3.7
> Removing a test from doctests, becaues it shouldn't be one
> Refactor argument clinic usage
> With the recent changes one performance optimization got lost
> FunctionExecutionContext should use the parent if possible
> Use anonymous instance arguments in a different way
> Move some anonymous instance function execution stuff
> Get rid of InstanceFunctionExecution, because it's really not needed
> Use the InstanceArguments for super as well
> Use InstanceArguments directly and not via InstanceFunctionExecution
> Remove old garbage code
> Don't use arguments that are not needed
> Also move the remaining get_params to get_executed_params
> get_params -> get_executed_params where possible
> Subprocess error reporting improvements
> Fix a recursion issue about compiled objects
> Use a CompiledInstanceNameFilter that wraps the class name as well
> Prefer Python 3 import over 2
> Now it's actually possible to specify a pytest environment for the same Python version
> Note that Python 3.3 support was dropped in Changelog
> Drop support for EOL Python 3.3 (#1019)
> Rewrite the pyc test
> Fix an issue with stderr debugging of subprocesses
> stderr of the child processes should be printed in debug output
> Use close_fds for posix.
> Remove some redundant code
> Use names of classes to infer names of instances
> Don't have execute and execute_evaluated on name
> Fix an issue where __ prefixed variables where not hidden when accessed from a class
> Bound methods are now working correctly in all Python versions. Therefore a test was wrong.
> Remove a print in tests
> BoundMethods now have access to the function that they are using
> Remove another usage of is_class where it's not needed
> FunctionContext should be created from a unified interface
> Don't create a FunctionExecutionContext if it's not used.
> Use TreeContext in a good way
> Fix broken link in documentation
> The implicit namespace package test from 4b276bae87a3170672f7ddb3e00f5851fe24d562 can only be used for Python 3.4+
> The import resolution for namespace packages was wrong
> Add a way to use the interpreter environment for tests
> MergedExecutedParams -> DynamicExecutedParams
> Fix a recursion error, fixes #1173
> Remove two recursion tests again that will belong into a commit at a point where it is not failing anymore
> Don't merge params if it's just one param
> Add a repr for AnonymousArguments
> Fix a doctest
> Some minor flake8 fixes
> Script.__repr__: include environment
> Add params to CallSignature.__repr__
> Environments are now always created on request
> Improve Environment
> Add max line length 100 to the config for flake8
> tests: use monkeypatch.setenv
> Don't test Python 3.3 on appveyor anymore, it's getting really hard to get all the right dependencies for it, because 3.3 is deprecated everywhere.
> Mention that it's ok to have a line length of 100 characters in our files.
> Don't use invalid escape sequences in regex, see https://github.com/davidhalter/jedi-vim/issues/843
> subprocess: listen: exit normally with EOFError
> Script: improve ValueError for column
> The sys path might be lazy or not in a venv
> The encoding parameter should be used again (includes test), fixes #1167
> Remove source_encoding from documentation (see #1167)
> Actually use the fast_parser setting again
> Use an import name list as long as possible
> Different _load_module API
> Directly load modules if possible, with this it's not necessary anymore to use dotted_from_fs_path, also fixes #1013.
> Don't mutate the sys.path. This is pretty nasty bug that fixes #1148
> Don't follow builtin imports anymore by default when follow_imports is on (goto)
> Add a changelog entry for the include_builtins change
> additional_module_paths in usages never actually worked
> Add include_builtins to usages, fixes #1131.
> Finally make it possible to use auto_import_modules for packages
> Test auto_import_modules in a very basic way
> Fix a bug about fstring completion
> Comprehensions are also possible arguments. Fixes 1146
.. image:: https://github.com/davidhalter/jedi-vim/blob/master/doc/logotype-a.svg
#################################################
jedi-vim - awesome Python autocompletion with VIM
#################################################
.. image:: https://travis-ci.org/davidhalter/jedi-vim.svg?branch=master
:target: https://travis-ci.org/davidhalter/jedi-vim
:alt: Travis-CI build status
jedi-vim is a VIM binding to the autocompletion library
`Jedi <http://github.com/davidhalter/jedi>`_.
Here are some pictures:
.. image:: https://github.com/davidhalter/jedi/raw/master/docs/_screenshots/screenshot_complete.png
Completion for almost anything (Ctrl+Space).
.. image:: https://github.com/davidhalter/jedi/raw/master/docs/_screenshots/screenshot_function.png
Display of function/class bodies, docstrings.
.. image:: https://github.com/davidhalter/jedi/raw/master/docs/_screenshots/screenshot_pydoc.png
Documentation (Pydoc) support (with highlighting, Shift+k).
There is also support for goto and renaming.
Get the latest from `github <http://github.com/davidhalter/jedi-vim>`_.
Documentation
=============
Documentation is available in your vim: ``:help jedi-vim``. You can also look
it up `on github <http://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt>`_.
You can read the Jedi library documentation `here <http://jedi.readthedocs.io/en/latest/>`_.
If you want to report issues, just use the github issue tracker. In case of
questions about the software, please use `stackoverflow
<https://stackoverflow.com/questions/tagged/jedi-vim>`_ and tag your question with ``jedi-vim``.
Contributing
============
We love Pull Requests! Read the instructions in ``CONTRIBUTING.md``.
Features
========
The Jedi library understands most of Python's core features. From decorators to
generators, there is broad support.
Apart from that, jedi-vim supports the following commands
- Completion ``<C-Space>``
- Goto assignments ``<leader>g`` (typical goto function)
- Goto definitions ``<leader>d`` (follow identifier as far as possible,
includes imports and statements)
- Show Documentation/Pydoc ``K`` (shows a popup with assignments)
- Renaming ``<leader>r``
- Usages ``<leader>n`` (shows all the usages of a name)
- Open module, e.g. ``:Pyimport os`` (opens the ``os`` module)
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
`Vundle <https://github.com/gmarik/vundle>`_ to install jedi-vim.
The first thing you need after that is an up-to-date version of Jedi. You can
either install it via ``pip install jedi`` or with
``git submodule update --init`` in your jedi-vim repository.
Example installation command using Pathogen:
.. code-block:: sh
git clone --recursive https://github.com/davidhalter/jedi-vim.git ~/.vim/bundle/jedi-vim
Example installation using Vundle:
Add the following line in your `~/.vimrc`
.. code-block:: vim
Plugin 'davidhalter/jedi-vim'
Installation with your distribution
-----------------------------------
On Arch Linux, you can also install jedi-vim from official repositories as
`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
to conflict with jedi-vim, therefore you should disable it before enabling
jedi-vim.
To enjoy the full features of jedi-vim, you should have VIM >= 7.3, compiled with
``+conceal`` (which is not the case on some platforms, including OS X). If your VIM
does not meet these requirements, the parameter recommendation list may not appear
when you type an open bracket after a function name. Please read
`the documentation <http://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt>`_
for details.
Settings
========
Jedi is by default automatically initialized. If you don't want that I suggest
you disable the auto-initialization in your ``.vimrc``:
.. code-block:: vim
let g:jedi#auto_initialization = 0
There are also some VIM options (like ``completeopt`` and key defaults) which
are automatically initialized, but you can skip this:
.. code-block:: vim
let g:jedi#auto_vim_configuration = 0
You can make jedi-vim use tabs when going to a definition etc:
.. code-block:: vim
let g:jedi#use_tabs_not_buffers = 1
If you are a person who likes to use VIM-splits, you might want to put this in your ``.vimrc``:
.. code-block:: vim
let g:jedi#use_splits_not_buffers = "left"
This options could be "left", "right", "top", "bottom" or "winwidth". It will decide the direction where the split open.
Jedi automatically starts the completion, if you type a dot, e.g. ``str.``, if
you don't want this:
.. code-block:: vim
let g:jedi#popup_on_dot = 0
Jedi selects the first line of the completion menu: for a better typing-flow
and usually saves one keypress.
.. code-block:: vim
let g:jedi#popup_select_first = 0
Jedi displays function call signatures in insert mode in real-time, highlighting
the current argument. The call signatures can be displayed as a pop-up in the
buffer (set to 1, the default), which has the advantage of being easier to refer
to, or in Vim's command line aligned with the function call (set to 2), which
can improve the integrity of Vim's undo history.
.. code-block:: vim
let g:jedi#show_call_signatures = "1"
Here are a few more defaults for actions, read the docs (``:help jedi-vim``) to
get more information. If you set them to ``""``, they are not assigned.
.. code-block:: vim
NOTE: subject to change!
let g:jedi#goto_command = "<leader>d"
let g:jedi#goto_assignments_command = "<leader>g"
let g:jedi#goto_definitions_command = ""
let g:jedi#documentation_command = "K"
let g:jedi#usages_command = "<leader>n"
let g:jedi#completions_command = "<C-Space>"
let g:jedi#rename_command = "<leader>r"
Finally, if you don't want completion, but all the other features, use:
.. code-block:: vim
let g:jedi#completions_enabled = 0
FAQ
===
I don't want the docstring window to popup during completion
------------------------------------------------------------
This depends on the ``completeopt`` option. Jedi initializes it in its
``ftplugin``. Add the following line to your ``.vimrc`` to disable it:
.. code-block:: vim
autocmd FileType python setlocal completeopt-=preview
I want <Tab> to do autocompletion
---------------------------------
Don't even think about changing the Jedi command to ``<Tab>``,
use `supertab <https://github.com/ervandew/supertab>`_!
The completion is too slow!
---------------------------
1. Completion of complex libraries (like Numpy) should only be slow the first
time you complete them. After that the results should be cached and very fast.
2. If it is still slow after the initial completion and you have installed the
python-mode Vim plugin, try disabling its rope mode:
.. code-block:: vim
let g:pymode_rope = 0
See issue `#163 <https://github.com/davidhalter/jedi-vim/issues/163>`__.
3. You can also use `deoplete-jedi <https://github.com/zchee/deoplete-jedi>`__
for completions, which uses Jedi, but does completions asynchronously
(requires Neovim).
It makes sense to use both jedi-vim and deoplete-jedi, but you should disable
jedi-vim's completions then:
.. code-block:: vim
let g:jedi#completions_enabled = 0
Testing
=======
jedi-vim is being tested with a combination of `vspec
<https://github.com/kana/vim-vspec>`_ and `py.test <http://pytest.org/>`_.
The tests are in the ``test`` subdirectory, you can run them calling::
py.test
The tests are automatically run with `travis
<https://travis-ci.org/davidhalter/jedi-vim>`_.
Description
Languages
Python
49.9%
Vim Script
49.3%
Makefile
0.8%