Using the VS Code plugin for Python
In this article, you'll learn how to access all the features the VS Code plugin has to offer for Python.
The only prerequisites are that you have Kite Engine running and the VS Code plugin installed. If you don't have the VS Code plugin installed, you can learn how to do so here.
Note: If you installed the VS Code plugin while VS Code was already running, you'll need to restart VS Code for the plugin to activate
Checking the Status of Kite
If Kite is installed properly, you should see a text indicator at the bottom right corner of the VS Code window.
There are a handful of possible states Kite can be in, as described in the following table:
|Kite: not Installed||Kite Engine is not installed.|
|Kite: not running||Kite Engine is not running.|
|Kite: indexing||The Kite Engine is analyzing your code.|
|Kite||Kite is ready to go - start coding!|
|No icon||This typically means that you are coding in an unsaved file or a filetype not yet supported by Kite.|
Note: If you're running Kite for the first time, it may take several minutes for Kite to finish indexing your codebase.
For the first two (red) states, you'll need to take manual action to install and/or run Kite.
Writing code and Accessing Features
In the following sections, the
$ character indicates the position of your editor's text cursor.
To start, open a Python file. Make sure that this file has been saved with a
.py extension. Now type the following code:
A list of suggested completions should automatically appear. When highlighted, Kite's completions are all marked with the
kite symbol on the right hand side.
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.$
Continuing with the example code above, complete the function call by typing the opening and closing parentheses.
import json json.dumps($)
Kite should show you information about how to call
json.dumps. Kite's signatures are also all marked with the
As you type, Kite will show you which argument you are currently focused on.
Note: If you have the official Microsoft Python extension installed, Kite will not be able to show you help for function signatures.
When you call a function, Kite may suggest snippets as completions you may choose. Snippets are denoted by placeholders enclosed with
<>. In the screenshot below, the highlighted completion has two placeholders:
When you select a snippet, you can use the
tab key to jump between placeholders as you edit them.
Kite can also quickly retrieve documentation for the code you are working with. If you hover your mouse over an identifier, you can click on the “Docs” link to open the documentation in the Copilot.
You may also select the
Kite: Docs At Cursor command from the command palette.
When triggered, the documentation shows up in the Copilot.
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 VS Code plugin provides a number of commands for ease of use. The GitHub repository contains information on the available commands.