Home - Tags - Bookmarks - About

Statement Completion for Dynamic languages in Sublime Text

Friday, 05 October 2012

This post describes how to configure Sublime Text in order to get statement completion for JavaScript, Python, (and perhaps PHP, RHTML, Smarty, Mason, Node.js, XBL, Tcl, HTML, HTML5, TemplateToolkit, XUL, Django, Perl, and Ruby).

After following the steps, statement completion will also work for Python projects installed in a virtualenv.

Install Package Manager

We have just installed Sublime Package Control - A full-featured package manager that helps discovering, installing, updating and removing packages for Sublime Text 2. It features an automatic updater and supports GitHub, BitBucket and a full channel/repository system.

Configure Statement Completion

The Install Package command shows a list of all available packages that are available for install. This will include all of the packages from the [default channel](http://wbond.net/sublime_packages/community), plus any from repositories you have added.

Configure Statement Completion for Python projects in virtualenv

You may skip this if you are not using virtualenv.

{
    "Python": {
        "python": '~/Documents/Projects/VirtualEnvName/bin/python',
        "pythonExtraPaths": ['~/Documents/Projects/VirtualEnvName/lib/python/site-packages',
        ]
    },
}

Note that VirtualEnvName is the name of the virtualenv were the files of the project are located.

The project itself is in ~/Documents/Projects/VirtualEnvName/ProjectName

Statement Completion in action

A screenshot for jQuery (note also the very cool theme)

A screenshot for jQuery

Also,

A screenshot for Document Object Model

A screenshot for Python

References:

━━━

This post has been filed under #sublime

Feedback

Have feedback on this page? Let @nikosbaxevanis know on twitter. Need help or found a bug? Contact me.


© 2011-2018 Nikos Baxevanis. All written content on this site is provided under a Creative Commons ShareAlike license. All code is provided under a MIT license unless otherwise stated.