Using the Sublime Text plugin

In this article, you'll learn how to access all the features the Sublime plugin has to offer.

Prerequisites

The only prerequisites are that you have Kite Engine running and the Sublime plugin installed. If you don't have the Sublime plugin installed, you can learn how to do so here.

Note: If you installed the Sublime plugin while Sublime was already running, you'll need to restart Sublime for the plugin to activate.

Checking the status of Kite

If Kite is installed properly, you should see a text indicator at the bottom left corner of the Sublime window.

There are a handful of possible states Kite can be in, as described in the following table:

Message Description
Kite: Not Installed Kite Engine is not installed.
Kite: Not running Kite Engine is not running.
Kite: Not logged in Kite Engine is running, but you need to log in.
Kite: Syncing Kite Engine is syncing your files to the cloud.
Kite: Indexing The Kite backend is analyzing your uploaded code.
Kite: Ready Kite is ready to go - start coding!
Note: If you're running Kite for the first time, it may take several minutes for Kite to finish syncing and indexing your codebase.

Whitelisting

If you start writing code in an un-whitelisted directory, the plugin will prompt you to whitelist the directory so that Kite can work properly.

Clicking on “OK” will whitelist the suggested directory. In this example, the root / directory would be whitelisted. Clicking on “Cancel” will suppress the current file. In this example, the file /test.py would be suppressed. Clicking on “Settings” will open your settings in the browser and also give you the option to suppress the file or the directory.

Writing code and accessing features

Completions

To start, open a Python file in a whitelisted directory. Make sure that this file has been saved with a .py extension. Now type the following code:

import json # Cursor stops behind the "j"

A list of suggested completions should automatically appear.

Kite can provide autocompletions for Python keywords, name expressions or attribute expressions. The example above illustrates a name expression completion. An example of an attribute completion would be:

import json
json.d # Cursor stops behind the "d"

In the case of name and attribute completions, Kite will also provide the type of value represented by the completion e.g. module or function.

Note: If these completions don't show up for you, you may need to tweak Sublime's autocomplete triggers by adding the following setting to your user preferences:
{
  "auto_complete_triggers": [
    {
      "characters": ".",
      "selector": "source.python - string - comment - constant.numeric"
    }
  ]
}

Function signatures

Continuing with the example code above, complete the function call to by typing the opening and closing parentheses.

import json
json.dumps() # Cursor is in between "(" and ")"

Kite should show you information about how to call json.dumps.

The top half of the UI shows the arguments available to be called. Keyword arguments will also have their default types shown. You may also click on the **kw link to show the arguments that are found in the keyword arguments dictionary.

As you type, Kite will show you which argument you are currently focused on.

If you have a Kite Pro subscription, the bottom half of the UI will show you the "Popular Patterns" associated with json.dumps. Each pattern represents a common way other programmers use the function, ranked from most popular to least popular using all the open source code available on GitHub. If you are calling a function that you have defined locally, Kite will extract patterns from your codebase directly instead of GitHub.

Expanding information

Kite also provides a UI to view more information about a Python identifier. If you hover your mouse over the identifier, you can click on the “more” link to get more information.

When triggered, the expanded information shows up as a popup.

You can scroll vertically within the popup to see all the information. The information shown contains:

  • Information about the value
    • In this case, the panel shows information about the function signature for json.dumps
    • However, the information here varies depending on what the value is e.g. module, type, instance, etc.
  • Summary
    • This is the documentation for the value
  • Usages from your code (Kite Pro subscribers only)
    • This shows you where else in your codebase you have used this value
  • Examples
    • Curated code examples that show you how to use the value
  • Links
    • Links to popular questions about this value on StackOverflow

Jump to definition

You can also jump to the definition of a module, class or function from your local codebase using Kite. The hover UI provides a def link to do so.

The popup with expanded information also contains a link to the definition.