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

  • Hands On: New VS Code Insiders Build Creates Web Page from Image in Seconds

    New Vision support with GitHub Copilot in the latest Visual Studio Code Insiders build takes a user-supplied mockup image and creates a web page from it in seconds, handling all the HTML and CSS.

  • Naive Bayes Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the naive Bayes regression technique, where the goal is to predict a single numeric value. Compared to other machine learning regression techniques, naive Bayes regression is usually less accurate, but is simple, easy to implement and customize, works on both large and small datasets, is highly interpretable, and doesn't require tuning any hyperparameters.

  • VS Code Copilot Previews New GPT-4o AI Code Completion Model

    The 4o upgrade includes additional training on more than 275,000 high-quality public repositories in over 30 popular programming languages, said Microsoft-owned GitHub, which created the original "AI pair programmer" years ago.

  • Microsoft's Rust Embrace Continues with Azure SDK Beta

    "Rust's strong type system and ownership model help prevent common programming errors such as null pointer dereferencing and buffer overflows, leading to more secure and stable code."

  • Xcode IDE from Microsoft Archrival Apple Gets Copilot AI

    Just after expanding the reach of its Copilot AI coding assistant to the open-source Eclipse IDE, Microsoft showcased how it's going even further, providing details about a preview version for the Xcode IDE from archrival Apple.

Subscribe on YouTube

Upcoming Training Events