mafisicoder avatar

Autocomplete for Python Coding in Sublime Text (ST3)

mafisicoder

Published: 14 Mar 2020 › Updated: 14 Mar 2020Autocomplete for Python Coding in Sublime Text (ST3)

Autocomplete for Python Coding in Sublime Text (ST3)

Wanted to be able to do AUTOCOMPLETE when editing my python codes

####Procedure

  1. I search the Internet for resource and sublimed on this which gave me recommendation on what to get

  2. So I looked for SublimeJEDI here.

  3. Following the instruction, I installed the package in my ST3.

  4. Now to the configuration part. To configure ST3 for SublimeJEDI integration, I went to Preference (MAC) -> Package Settings -> Jedi -> Settings -Default
    alt

  5. Add your Virtual Environment and also the path any additional Python package

    {
    // You can set a path to your python virtualenv,
    // for example /home/user/.virtualenvs/myenv).
    // Note: Interpreter path would be found automaticaly
    "python_virtualenv": "/Users/macbookpro/environments",

     // You can set a path to your python interpreter,
     // for example `/home/user/.virtualenvs/myenv/bin/python)`.
     "python_interpreter": "/Users/macbookpro/environments/bin/python3",
    
     // Additional python package paths.
     "python_package_paths": ["/Users/macbookpro/Documents/projects/autotask-python/autotask-Env/"],
    

    }

  6. Add how you would want Jedi to handle the autocompletting task. My example below makes sure that Jedi provides autocomplete suggestions after a DOT and not during typing.

    // When to modifiy
    "only_complete_after_regex": "\.",

  7. The final step is to add the settings to User.Preference Settings. Preferences.sublime-settings - User

    {
    // ........

     // Added my settings here
     // Modify Python on DOT
     //# User/Preferences.sublime-settings or User/Python.sublime-settings
     "auto_complete_triggers": [
     {
         "selector": "source.python",
         "characters": "."
     }],
    
    
     // Auto-completion ONLY on dot and not while typing, 
     // you can set (additionally to the trigger above):
     "auto_complete_selector": "-",
    
     // Jedi auto-completion only after the . character 
     // but don't want to affect auto-completion from other packages
     "only_complete_after_regex": "\\.",
    

    }

Leave Autocomplete for Python Coding in Sublime Text (ST3) to:

Written by

Just another guy that is crazy with new technology. And mad overheels with blockchain. You would see more of me.

Read more #sublime posts


Best Posts From mafisicoder

We have not curated any of mafisicoder's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From mafisicoder