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 for Converge360.

comments powered by Disqus

Featured

  • Full Stack Hands-On Development with .NET

    In the fast-paced realm of modern software development, proficiency across a full stack of technologies is not just beneficial, it's essential. Microsoft has an entire stack of open source development components in its .NET platform (formerly known as .NET Core) that can be used to build an end-to-end set of applications.

  • .NET-Centric Uno Platform Debuts 'Single Project' for 9 Targets

    "We've reduced the complexity of project files and eliminated the need for explicit NuGet package references, separate project libraries, or 'shared' projects."

  • Creating Reactive Applications in .NET

    In modern applications, data is being retrieved in asynchronous, real-time streams, as traditional pull requests where the clients asks for data from the server are becoming a thing of the past.

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

Subscribe on YouTube