News

VS Code Gets AI-Assisted IntelliCode for Python

Python developers using Visual Studio Code are getting an AI-assisted boost from the editor's IntelliCode extension.

IntelliCode leverages machine learning algorithms to provide AI-assisted coding tips that go beyond regular IntelliSense code-completion hints. Its machine learning model is trained on more than 2,000 Python project repos, letting IntelliCode infer the correct code-completion suggestions from the context in which the code is being typed.

By using this advanced inference capability, IntelliCode predicts what a programmer is aiming for as a line of code is typed in, presenting the most likely code-completion options in the top its suggestion list, marked by stars. Previously, with IntelliSense, a wide range of options would be presented, requiring manual winnowing down to find the desired choice.

Python IntelliCode in Animated Action
[Click on image for larger, animated view.] Python IntelliCode in Animated Action (source: Microsoft).

Now, when a programmer types in a variable, the list of suggestions changes depending on the surrounding code.

"When writing Python code, the IntelliSense code completion speeds up your productivity by providing suggestions as you type," a July 24 Visual Studio blog post said. "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."

Using the new AI-assisted technology requires installation of the Visual Studio IntelliCode - Preview extension and the wildly popular (more than 15 million installs) Python extension. After those are installed, IntelliCode will download the latest machine learning model to provide the most relevant suggestions.

The tools rely upon the Microsoft Python Language Server, also in preview, that provides the programming language "smarts" to IDEs and code editors for advanced IntelliSense/IntelliCode functionality.

The language server allowed Microsoft to extract the highly touted Python IntelliSense from its flagship Visual Studio IDE and make it a portable, standalone product, recently bundled into the VS Code Python extension.

It provides benefits such as:

  • Syntax errors as you type in code
  • Warnings when modules are not found
  • Using Typeshed files to fill in missing completions for modules
  • Improved performance for analyzing your workspace and presenting completions
  • Ability to detect syntax errors on your entire workspace, rather than just the current file
  • Faster startup times
  • Faster imports
  • Better handling for a number of language constructs

"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, said Dan Taylor, Senior Program Manager, Python Developer Tools, in the post. "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."

The Visual Studio IntelliCode preview extension, which only pertains to the July release of VS Code, has been installed 2,355 times at the time of this writing, earning a perfect 5.0 rating from three reviewers. More information on the new offering is available in a July 24 Channel 9 video.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • VS Code Copilot Previews New GPT-4o AI Code Completion Model

    The 4o upgrade includes additional training on more than 275,000 high-quality public repositories in over 30 popular programming languages, said Microsoft-owned GitHub, which created the original "AI pair programmer" years ago.

  • Microsoft's Rust Embrace Continues with Azure SDK Beta

    "Rust's strong type system and ownership model help prevent common programming errors such as null pointer dereferencing and buffer overflows, leading to more secure and stable code."

  • Xcode IDE from Microsoft Archrival Apple Gets Copilot AI

    Just after expanding the reach of its Copilot AI coding assistant to the open-source Eclipse IDE, Microsoft showcased how it's going even further, providing details about a preview version for the Xcode IDE from archrival Apple.

  • Introduction to .NET Aspire

    Two Microsoft experts will present on the cloud-native application stack designed to simplify the development of distributed systems in .NET at the Visual Studio Live! developer conference coming to Las Vegas next month.

  • Microsoft Previews Copilot AI for Open-Source Eclipse IDE

    Catering to Java jockeys, Microsoft is yet again expanding the sprawling reach of its Copilot-branded AI assistants, previewing a coding tool for the open-source Eclipse IDE.

Subscribe on YouTube

Upcoming Training Events