Python in Visual Studio Code – February 2022 Release
We are pleased to announce that the February 2022 release of the Python Extension for Visual Studio Code is now available. This release includes:
- Smart Selection
- Folding support
- Improvements to the Python interpreters list
- Improvements when using Anaconda
If you’re interested, you can check the list of improvements in our changelog.
Selecting Python code using the keyboard takes fewer key presses now thanks to Smart Selection via Pylance. This was a highly requested feature, and it takes into account your code structure and heuristics to define the selection range. You can expand your code selection with
Shift + Alt + Right Arrow or
⇧ + ⌥ + Right Arrow, and shrink it with
Shift + Alt + Left Arrow or
⇧ + ⌥ + Left Arrow.
Theme: Monokai – High Contrast
We’ve also made improvements to folding support via Pylance. 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).
You can fold regions of source code using the folding icons on the gutter between line numbers and line start. Move the mouse over the gutter and click to fold and unfold regions. Use
Shift + Click or
⇧ + Click on the folding icon to fold or unfold the region and all regions inside.
Theme: Horizon Extended
Improvements to the Python interpreters list
Similarly to how kernels are display in the Jupyter extension, the Python extension’s interpreters list now displays Python interpreters grouped by type to make it easier to identify them:
Improvements when using Anaconda
This release includes several improvements to the experience when using Anaconda environments. Previously, there would be issues when debugging files and running tools using conda environments unless VS Code was initiated in an activated conda environment. To resolve several of these issues (#5559, #11205, #11638), the Python extension is using “conda run” to execute files and tools.
There are known issues when there are special characters in file paths, or when using custom command lines arguments in VS Code (although the Anaconda team is already working on fixing it). If you experience any of these issues, we recommend you check to see if conda has been released with a fix, otherwise start VS Code (“code .” command) from an activated conda environment from an external terminal.
Other Changes and Enhancements
We have also added small enhancements and fixed issues requested by users that should improve your experience working with Python in Visual Studio Code. Some notable changes include:
- Improve select folder quickpick UI in multiroot workspaces. (#18256)
- Drop support for Python 3.6 (as it reached end-of-life in December). (#18272)
We would also like to extend special thanks to this month’s contributors:
- Marc Mueller: Add support for pylint error ranges. Requires Python 3.8 and pylint 2.12.2 or higher. (#18068)
- ted1030: Update Chinese – Taiwan (zh-tw) translations. (#17991)
- Keshav Kini: Improve unit tests for envVarsService. (#17747)
- Harry-Hopkinson: Fixed typescript and namespace errors. (#18345)
Try out these new improvements by downloading the Python extension from the Marketplace, or install it directly from the extensions view in Visual Studio Code (
Ctrl + Shift + X or
⌘ + ⇧ + X). You can learn more about Python support in Visual Studio Code in the documentation. If you run into any problems or have suggestions, please file an issue on the Python VS Code GitHub page.
Why does the VS code team always writes about Java and Python while note exactly telling what has changed and what has improved overall I mean if you want to see the change now and you open the app and try to see it hints you to the GitHub repository where it is impossible for beginners and even moderate users to understand what has changed and what has improved overall please also do better bigger and simpler blog posts for new updates in VS code as well And in this page too