Autocomplete for Python Coding in Sublime Text (ST3)

in python •  5 years ago  (edited)

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

  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": "\\.",
    

    }

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!