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 41K
  • Win 16K
  • OS X 12K
  • Linux 13K
Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25 Aug 24 Aug 23 Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3 Aug 2 Aug 1 Jul 31 Jul 30 Jul 29 Jul 28 Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19
Windows 22 37 35 21 30 56 34 25 36 45 25 31 35 32 35 31 36 23 22 40 36 34 40 39 18 37 34 36 31 46 49 29 52 44 48 40 84 52 20 20 32 31 31 37 30 28
OS X 10 20 20 26 17 20 14 34 27 19 11 16 20 22 24 25 17 20 13 20 14 33 18 22 18 22 21 18 22 20 19 14 15 13 22 32 24 23 17 16 27 23 20 17 22 19
Linux 16 28 25 24 11 17 28 28 21 22 19 12 23 27 11 30 16 15 20 20 27 24 21 26 17 10 16 23 26 29 16 16 16 22 20 32 33 23 10 17 13 20 15 22 25 20

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