forked from VimPlug/jedi
Changed directory structure
This commit is contained in:
45
docs/docs/installation.rst
Normal file
45
docs/docs/installation.rst
Normal file
@@ -0,0 +1,45 @@
|
||||
Installation and Configuration
|
||||
==============================
|
||||
|
||||
You can either include *Jedi* as a submodule in your text editor plugin (like
|
||||
jedi-vim_ does it by default), or you can install it systemwide.
|
||||
|
||||
|
||||
System-wide installation via a package manager
|
||||
----------------------------------------------
|
||||
|
||||
You can install *Jedi* directly from pypi using pip::
|
||||
|
||||
sudo pip install jedi
|
||||
|
||||
If you want to install the current development version::
|
||||
|
||||
sudo pip install -e git://github.com/davidhalter/jedi.git#egg=jedi
|
||||
|
||||
.. note:: This just installs the Jedi library, not the editor plugins. For
|
||||
information about how to make it work with your editor, refer to the
|
||||
corresponding documentation.
|
||||
|
||||
|
||||
Manual installation from a downloaded package
|
||||
---------------------------------------------
|
||||
|
||||
If you prefer not to use an automated package installer, you can download a
|
||||
copy of *Jedi* and install it manually.
|
||||
|
||||
To install it, navigate to the directory containing `setup.py` on your console
|
||||
and type::
|
||||
|
||||
sudo python setup.py install
|
||||
|
||||
|
||||
Inclusion as a submodule
|
||||
------------------------
|
||||
|
||||
If you use an editor plugin like jedi-vim_, you can simply include *Jedi* as a
|
||||
git submodule of the plugin directory. Vim plugin managers like Vundle_ make it
|
||||
very easy to keep submodules up to date.
|
||||
|
||||
|
||||
.. _jedi-vim: https://github.com/davidhalter/jedi-vim
|
||||
.. _Vundle: https://github.com/gmarik/vundle
|
||||
96
docs/docs/plugin-api.rst
Normal file
96
docs/docs/plugin-api.rst
Normal file
@@ -0,0 +1,96 @@
|
||||
The Plugin API
|
||||
==============
|
||||
|
||||
.. currentmodule:: jedi
|
||||
|
||||
Note: This documentation is for Plugin developers, who want to improve their
|
||||
editors/IDE autocompletion
|
||||
|
||||
If you want to use **Jedi**, you first need to
|
||||
``import jedi``. You then have direct access to the :class:`.Script`.
|
||||
|
||||
|
||||
API documentation
|
||||
-----------------
|
||||
|
||||
API Interface
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
.. automodule:: api
|
||||
:undoc-members:
|
||||
|
||||
|
||||
API Return Classes
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. automodule:: api_classes
|
||||
:undoc-members:
|
||||
|
||||
Jedi setting interface
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. automodule:: settings
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
Completions:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> import jedi
|
||||
>>> source = '''import json; json.l'''
|
||||
>>> script = jedi.Script(source, 1, 19, '')
|
||||
>>> script
|
||||
<jedi.api.Script object at 0x2121b10>
|
||||
>>> completions = script.complete()
|
||||
>>> completions
|
||||
[<Completion: load>, <Completion: loads>]
|
||||
>>> completions[1]
|
||||
<Completion: loads>
|
||||
>>> completions[1].complete
|
||||
'oads'
|
||||
>>> completions[1].word
|
||||
'loads'
|
||||
|
||||
Definitions / Goto:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> import jedi
|
||||
>>> source = '''def my_func():
|
||||
... print 'called'
|
||||
...
|
||||
... alias = my_func
|
||||
... my_list = [1, None, alias]
|
||||
... inception = my_list[2]
|
||||
...
|
||||
... inception()'''
|
||||
>>> script = jedi.Script(source, 8, 1, '')
|
||||
>>>
|
||||
>>> script.goto()
|
||||
[<Definition inception=my_list[2]>]
|
||||
>>>
|
||||
>>> script.get_definition()
|
||||
[<Definition def my_func>]
|
||||
|
||||
Related names:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> import jedi
|
||||
>>> source = '''x = 3
|
||||
... if 1 == 2:
|
||||
... x = 4
|
||||
... else:
|
||||
... del x'''
|
||||
>>> script = jedi.Script(source, 5, 8, '')
|
||||
>>> rns = script.related_names()
|
||||
>>> rns
|
||||
[<RelatedName x@3,4>, <RelatedName x@1,0>]
|
||||
>>> rns[0].start_pos
|
||||
(3, 4)
|
||||
>>> rns[0].is_keyword
|
||||
False
|
||||
>>> rns[0].text
|
||||
'x'
|
||||
Reference in New Issue
Block a user