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

  • IDE Irony: Coding Errors Cause 'Critical' Vulnerability in Visual Studio

    In a larger-than-normal Patch Tuesday, Microsoft warned of a "critical" vulnerability in Visual Studio that should be fixed immediately if automatic patching isn't enabled, ironically caused by coding errors.

  • Building Blazor Applications

    A trio of Blazor experts will conduct a full-day workshop for devs to learn everything about the tech a a March developer conference in Las Vegas keynoted by Microsoft execs and featuring many Microsoft devs.

  • Gradient Boosting Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the gradient boosting regression technique, where the goal is to predict a single numeric value. Compared to existing library implementations of gradient boosting regression, a from-scratch implementation allows much easier customization and integration with other .NET systems.

  • Microsoft Execs to Tackle AI and Cloud in Dev Conference Keynotes

    AI unsurprisingly is all over keynotes that Microsoft execs will helm to kick off the Visual Studio Live! developer conference in Las Vegas, March 10-14, which the company described as "a must-attend event."

  • Copilot Agentic AI Dev Environment Opens Up to All

    Microsoft removed waitlist restrictions for some of its most advanced GenAI tech, Copilot Workspace, recently made available as a technical preview.

Subscribe on YouTube