News

Visual Studio Code Python Extension Improves Linting, More

Microsoft's Visual Studio Code team has updated the popular, open source Python extension it acquired a few months ago, adding yet more functionality to the tool that has been installed more than 6 million times.

As we reported in November, the team has gone all in on Python support, hiring the extension's author, Don Jayamanne, taking over the project and hiring additional Python programmers to help out.

VS Code is getting industry accolades for its programming language support (more than 150 languages), enabled by the Microsoft's Language Server Protocol, which provides language-specific intelligence and communicates with development tools via a protocol enabling inter-process communication that allows for functionality such as auto code complete, go to definition, documentation on hover and so on.

Linting -- in which the editor analyzes source code for potential errors -- is also provided by language servers, and that functionality is improved in the January 2018 release.

"In this release we closed a total of 72 issues focusing on linting improvements, support for virtual environments, and other general improvements," said Microsoft's Dan Taylor in a Feb. 1 post.

Those linting improvements affect Pylint (the default linter) rules and provide easier linting configuration.

Default Pylint rules now call for displaying only errors and warnings about possible coding mistakes that could actually cause runtime exceptions. Style rule warnings -- and some other warnings -- are no longer shown under the default configuration. Taylor said this cuts down on the "unnecessary noise" of the linting experience, focusing only on the more problematic issues rather than displaying warnings about variable or function names, for examples. Of course, the rules can be customized to suit different developers.

Also, some linter setting can now be set via commands rather than the manual process of editing configuration files.

"The Python: Select Linter command allows you to select your linter of choice, and the Python: Enable Linting allows you to enable and disable linting," Taylor said.

He also noted the Python terminal now supports virtual environments in addition to conda (a language-agnostic package manager and environment management system), either of which can be pre-selected to they automatically activate upon opening a new terminal window. This means, for example, a Flask app can run if Flask support is activated in a virtual environment, even though Flask isn't installed globally on the dev machine. Previously, without virtual environment support, the terminal would use the global Python interpreter and -- upon finding no Flask support -- launching the app from the terminal wouldn't work.

The extension in the Visual Studio Marketplace is nearing 6.2 million downloads as of this writing and has earned an average 4.6 rating (0-5 scale) from 162 reviewers. When we reported Jayamanne's hiring last November, it had been installed 4.2 million times and had an average 4.7 rating from 139 reviewers, speaking to the popularity of the project.

About the Author

David Ramel is the editor of Visual Studio Magazine.

comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.