Visual Studio IntelliCode expands AI-assisted coding to Python in Visual Studio Code

Dan

July 24th, 2018

Today at the EuroPython conference in Edinburgh, Scotland, we are introducing support for Python in the IntelliCode extension for Visual Studio Code, as well as new improvements in editing for Python developers in Visual Studio Code.

AI-assisted IntelliSense for Python

At Microsoft Build 2018, we first announced IntelliCode, a set of AI-assisted capabilities to improve developer productivity. We shipped a preview extension showing the first of these capabilities: presenting the most relevant completions as you type in Visual Studio. Today, we are bringing the power of machine learning trained on over 2,000 open-source repos to Python developers using Visual Studio Code. Check out the video below to see IntelliCode for Python in action.

When writing Python code, the IntelliSense code completion speeds up your productivity by providing suggestions as you type. However, there can be hundreds of completions to scroll through, and you typically need to type the first few characters out before you can get close to the right result. Using our machine learning algorithm, IntelliCode can infer the most relevant completions based on the current code context.

In the below example of writing TensorFlow code, we can see the starred items in the completion list are provided by IntelliCode, allowing you to select from the top items rather than having to search through the completion list:

Notice how in each case we used the “tf.” variable but the suggestions change to present the most relevant options for the code context in which the tf variable is being used.

These suggestions work on a broad variety of code included in our 2,000+ repo training set: machine learning frameworks, web frameworks, to general purpose scripting. Simply install both the IntelliCode extension and the Python extension, and IntelliCode will download the latest machine learning model and start making suggestions.

Microsoft Python Language Server (Preview)

For Python, IntelliCode builds on top of our Microsoft Python Language Server: our fast and powerful language server which was introduced in the July 2018 release of the Python extension for Visual Studio Code.

IntelliCode will prompt you to enable the Microsoft Python Language server, so you’ll also notice that you get enhanced IntelliSense with syntax errors and basic warnings will now appear as you type. IntelliSense, combined with the new Python Language Server, is also richer: the language server uses open-source typeshed definitions to provide completions for types where they can’t be statically inferred.

The combination of both the new Python extension features and IntelliCode will make you more productive when writing everyday Python code.

More Improvements for Python in Visual Studio Code

We have been continuing to add improvements for Python developers in Visual Studio Code. At Build 2018, we announced the public preview of Visual Studio Live Share including support for Python, allowing you to collaborate on code with other co-workers regardless of whether they are using the Visual Studio IDE or Visual Studio Code for their Python coding.

For everything else Python at Microsoft, be sure to check out our Python at Microsoft blog.

Get Involved

As we expand IntelliCode’s capabilities to more scenarios and other languages, we’ll announce a limited private preview of new features.

Sign up to become an insider to keep up with the project and join the waitlist for the private preview.