News

What's New in Python in Visual Studio Code for February 2022

The regular monthly update to Python in Visual Studio Code is out with four main improvements.

The dev team for Python in VS Code manages the Python extension in the VS Code marketplace, providing IntelliSense, linting, debugging and so on. At more than 50 million installs, it's by far the most popular tool in the marketplace.

According to a Feb. 3 announcement, improvements to Python in VS Code affect Smart Selection, folding support, the Python interpreters list and Anaconda functionality.

Here are summaries of each feature:

Smart Selection
Thanks to Smart Selection via Pylance, developers can now use fewer keystrokes to select sections of code when using the keyboard. Pylance, which is now the default language server for Python in VS Code, provides IntelliSense and other language-specific functionality. "This was a highly requested feature, and it takes into account your code structure and heuristics to define the selection range," Microsoft said. Code selection can be expanded with various key combination commands, as shown in this animated GIF:

Smart Selection in Animated Action
[Click on image for larger view.] Smart Selection in Animated Action (source: Microsoft).

Folding Support
Pylance is also responsible for improved folding support, which is done by clicking on little arrow-like folding icons to show or hide code segments. "Previously, the folding regions were defined just by indentation, which was not ideal for some cases, for example, with multi-line strings as pointed out in our issue tracker. Now folding regions take into account semantic information appropriately (this includes #region comments)."

Improvements to the Python Interpreters List
The Python extension’s interpreters list now groups Python interpreters by type for easier identification. Microsoft said this new grouping scheme is similar to that used by to display kernels in the Jupyter extension.

Improvements when Using Anaconda
Using Anaconda environments is now easier in several ways. "Previously, there would be issues when debugging files and running tools using conda environments unless VS Code was initiated in an activated conda environment," Microsoft said. "To resolve several of these issues (#5559, #11205, #11638), the Python extension is using 'conda run' to execute files and tools."

All of the above and more are mentioned in the changelog, which shows these enhancements:

  • Add support for conda run without output, using --no-capture-output flag. (#7696)
  • Add an option to clear interpreter setting for all workspace folders in multiroot scenario. (#17693)
  • Public API for environments (proposed). (#17905)
  • Group interpreters in interpreter quick picker using separators. (#17944)
  • Add support for pylint error ranges. Requires Python 3.8 and pylint 2.12.2 or higher. (thanks Marc Mueller) (#18068)
  • Move pinned interpreter status bar item towards the right behind pythonInterpreterInfoPinned experiment. (#18282)
  • Move interpreter status bar item into the Python language status item behind pythonInterpreterInfoUnpinned experiment. (#18283)
  • Update Jedi language server to latest. (#18325)

The changelog also lists fixes and improvements to code health.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Mastering Blazor Authentication and Authorization

    At the Visual Studio Live! @ Microsoft HQ developer conference set for August, Rockford Lhotka will explain the ins and outs of authentication across Blazor Server, WebAssembly, and .NET MAUI Hybrid apps, and show how to use identity and claims to customize application behavior through fine-grained authorization.

  • Linear Support Vector Regression from Scratch Using C# with Evolutionary Training

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the linear support vector regression (linear SVR) technique, where the goal is to predict a single numeric value. A linear SVR model uses an unusual error/loss function and cannot be trained using standard simple techniques, and so evolutionary optimization training is used.

  • Low-Code Report Says AI Will Enhance, Not Replace DIY Dev Tools

    Along with replacing software developers and possibly killing humanity, advanced AI is seen by many as a death knell for the do-it-yourself, low-code/no-code tooling industry, but a new report belies that notion.

  • Vibe Coding with Latest Visual Studio Preview

    Microsoft's latest Visual Studio preview facilitates "vibe coding," where developers mainly use GitHub Copilot AI to do all the programming in accordance with spoken or typed instructions.

  • Steve Sanderson Previews AI App Dev: Small Models, Agents and a Blazor Voice Assistant

    Blazor creator Steve Sanderson presented a keynote at the recent NDC London 2025 conference where he previewed the future of .NET application development with smaller AI models and autonomous agents, along with showcasing a new Blazor voice assistant project demonstrating cutting-edge functionality.

Subscribe on YouTube