News
Visual Studio's Python IntelliSense Goes Standalone, Previews in VS Code Extension
Microsoft is converting the baked-in Python IntelliSense support in Visual Studio into an open source standalone product and previewing it in the new update to the VS Code Python extension.
Visual Studio's IntelliSense code analysis and code completion suggestions have worked with Python since the language's infusion into the IDE in 2011. Now the company has leveraged its Language Server Protocol to make that Python goodness portable in the form of the Python Language Server.
"It is available first today in the July release of the Python Extension for Visual Studio Code, and we will later release it as a standalone component that you can use with any tool that works with the Language Server Protocol," Microsoft's Steve Dower said in a post yesterday.
The Language Server Protocol defines the protocol used between a code editor or IDE and a language server that provides language features like auto complete, go to definition, find all references and so on. Through it, functionality like IntelliSense that was previously provided by complicated static analysis closely tied to specific editors or IDEs is made portable, offered up by a server rather than the editor/IDE. Thus editors/IDEs that support the protocol can get IntelliSense for any programming language it works with.
"Previously, Python IntelliSense in Visual Studio was very specific to that IDE," Dower explained. "We have been developing this support for nearly a decade. It has an impressively deep understanding of the Python language, but only Visual Studio users have been able to enjoy this work. Recently we have been refactoring our implementation to separate it from Visual Studio and make it available as a standalone program using the Language Server Protocol.
"The end result is that we have a black box that takes Python code and provides all the information your editor needs for tooltips, completions, finding definitions and references, global variable renaming and more."
As a preview available in the latest update to the VS Code Python extension, Microsoft yesterday said it provides the following benefits (already available or soon coming in Visual Studio) to VS Code developers:
- 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
Those details were provided in a post announcing the June/July releases of the VS Code Python extension. Microsoft's Brett Cannon also announced the team has closed 156 issues in the new releases, which also incorporate gevent launch configuration for debugging.
"Contributed by Bence Nagy at the PyCon US 2018 sprints, the experimental debugger now supports a gevent launch configuration for code that has been monkey-patched by gevent," Cannon said. "A predefined debugging template named 'Python Experimental: Gevent' is available, as well as adding the setting "gevent": true to any launch configuration."
The Python extension is the most popular offering in the Visual Studio Code Marketplace. It boasts more than 13.9 million installs and has earned a 4.6 (out of 5 max) from 182 developers who reviewed it.
Dower said by making Visual Studio's Python IntelliSense portable and cross-platform, the team can improve it for both Visual Studio and VS Code at the same time. The standalone release of the Python Language Server is expected in the next few months, he said, and will be available under the Apache 2.0 license.
About the Author
David Ramel is an editor and writer at Converge 360.