ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Jedi - Python autocompletion

by srusskih ST2/ST3

awesome Python autocompletion with SublimeText

Details

Installs

  • Total 38K
  • Win 14K
  • OS X 11K
  • Linux 12K
Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4 Jun 3 Jun 2 Jun 1 May 31 May 30 May 29 May 28 May 27 May 26 May 25 May 24 May 23
Windows 29 39 19 19 33 30 37 38 38 33 31 51 30 45 22 30 21 22 29 23 38 36 36 21 39 31 22 37 53 26 28 21 28 30 53 32 43 30 25 33 37 24 38 32 13 20
OS X 12 12 13 18 20 28 21 26 19 16 12 17 27 26 32 25 8 15 18 27 14 27 29 16 25 25 22 18 21 19 13 19 25 22 19 27 35 18 13 34 32 26 11 20 15 8
Linux 10 34 16 18 26 21 20 36 31 13 19 20 24 21 20 21 11 23 28 16 27 20 24 8 14 18 22 20 33 15 16 18 22 18 31 17 21 21 14 20 22 27 41 23 16 15

Readme

Source
raw.​githubusercontent.​com

SublimeJEDI

Gitter

SublimeJEDI is a Sublime Text 2 and Sublime Text 3 plugin to the awesome autocomplete library Jedi

Installation

with Git

cd ~/.config/sublime-text-2/Packages/
git clone https://github.com/srusskih/SublimeJEDI.git "Jedi - Python autocompletion"

with Sublime Package Control

  1. Open command pallet (default: ctrl+shift+p)
  2. Type package control install and select command Package Control: Install Package
  3. Type jedi and select “SublimeJEDI”

Additonal info installations you can find here http://wbond.net/sublime_packages/package_control/usage

Settings

Python interpreter settings

By default SublimeJEDI will use default Python interpreter from the PATH. Also you can set different interpreter for each Sublime Project.

To set project related Python interpreter you have to edit yours project config file. By default project config name is <project name>.sublime-project

You can set Python interpreter, and additional python package directories, using for example the following:

# <project name>.sublime-project
{
    // ...

    "settings": {
        // ...
        "python_interpreter": "$project_path/../../virtual/bin/python",

        "python_package_paths": [
            "$home/.buildout/eggs",
            "$project_path/addons",
            ]
    }
}

When setting paths, Sublime Text Build System Variables and OS environment variables are automatically expanded. Note that using placeholders and substitutions, like in regular Sublime Text Build System paths is not supported.

Autocomplete on DOT

If you want auto-completion on dot, you can define a trigger in the Sublime User or Python preferences:

# User/Preferences.sublime-settings or User/Python.sublime-settings
{
    // ...
    "auto_complete_triggers": [{"selector": "source.python", "characters": "."}],
}

If you want auto-completion ONLY on dot and not while typing, you can set (additionally to the trigger above):

# User/Preferences.sublime-settings or User/Python.sublime-settings
{
    // ...
    "auto_complete_selector": "-",
}

Function args fill up on completion

SublimeJEDI allow fill up function parameters by default. Thanks to @krya, now you can turn it off. Function parameters completion has 3 different behavior:

  • insert all function arguments on autocomplete

    # complete result
    func(a, b, c, d=True, e=1, f=None)
    
    # sublime_jedi.sublime-settins
    {
        "auto_complete_function_params": "all"
    }
    
  • insert only required arguments that don't have default value (default behavior)

    # complete result
    func(a, b, c)
    
    # sublime_jedi.sublime-settins
    {
        "auto_complete_function_params": "required"
    }
    
  • do not insert any arguments

    # complete result
    func()
    
    # sublime_jedi.sublime-settins
    {
        "auto_complete_function_params": ""
    }
    

Completion visbility

Sublime Text has a bit strange completion behavior and some times does not adds it's own completion suggestions. This option is try to bring more comfortable workflow.

  • Suggest only Jedi completion

    # sublime_jedi.sublime-settins
    {
        "sublime_completions_visibility": "jedi"
    }
    

or

# sublime_jedi.sublime-settins
    {
        "sublime_completions_visibility": "default"
    }
  • Suggest Jedi completion and Sublime completion in the end of the list

    # sublime_jedi.sublime-settins
    {
        "sublime_completions_visibility": "list"
    }
    

Please note, if you are using SublimeAllAutocomplete - you should not care about this option.

Jedi Goto / Go Definition

Find function / variable / class definition

Shortcuts: CTRL+SHIFT+G

Mouse binding, was disabled, becase it's hard to keep ST default behavior. Now you can bind CTRL + LeftMouseButton by themself in this way:

# User/Default.sublime-mousemap
[{
    "modifiers": ["ctrl"], "button": "button1",
    "command": "sublime_jedi_goto",
    "press_command": "drag_select"
}]

Jedi Find Related Names (“Find Usages”)

Find function / method / variable / class usage, definition

Shortcut: Alt+Shift+f

Jedi Show Docstring

Show docstring in output panel

Exposed command is sublime_jedi_docstring which can be assigned to appropriate shortcut (i.e. F1)

Jedi Show Calltip

Show calltip in status bar

Exposed command is sublime_jedi_signature

Logging

To change logging level of the plugin - change logging_level value in settings.

Possible values: “debug”, “info”, “error”

# User/sublime_jedi.sublime-settings
{
    // ...
    "logging_level": "error"
}

License

MIT