Python extension in Virtual Studio Code is one of the most popular tools available now. It is managed by the dev team for Python in VS Code. This team works for IntelliSense, linting, debugging, and so on. The extension has currently more than 50 million installs. Python extension monthly update was launched on February 3, 2022, by Microsoft. It contains four releases including Smart Selection, Folding Support, Improvements to the Python interpreters list, Improvements when using Anaconda. So let’s discuss which are the main features added in the Python VS code 2022 release.
1. Folding Support
Dev team has made improvements to folding support using Pylance. Before this release, folding regions were just limited to indentation. It was not ideal for most of the cases like multi-line strings. It was raised as an issue on June 3, 2021, by users in the issue tracker of vs code. From now folding regions will take semantic information appropriately into account. It will also include #region comments.
You can fold regions of source code using folding icons on gutter button line numbers and line start. Just follow the procedure below to fold and unfold regions respectively:
- Move the mouse over gutter button (located between line numbers and line start).
- Click to fold and unfold regions.
- You can also fold or unfold by using Shift+ Click or (↑ on keyboard + Click) on folding icon to fold or unfold region and all regions inside.
2. Smart Selection in Python in VS Code
Before the release of this python in vs code update, selecting python code was tedious work. But now it will be a matter of just a few clicks on the keyboard. It is termed as Smart selection. This feature is contributed by Pylance. It was a highly requested feature since many times. However, the selection range will depend on your code structure and heuristics. You can expand your code selection with any key on keyboard below:
- Shift+ Alt+ Right Arrow.
- ↑+ Right Arrow.
You can shrink your code using any key below:
- Shift+ Alt+ Left Arrow.
- ↑+ Left Arrow.
3. Improvements to Python in VS Code Interpreters List
It is a new feature that is similar to kernels displayed in the Jupyter extension. The python’s interpreters list will now display Python interpreters grouped by type. It will make it easier to identify them. Just have a look at the image below to have a glimpse at the improvement featured.
4. Improvements When Using Anaconda
This monthly update will bring several improvements to the user’s experience when using Anaconda environments. Before the update in the python extension, there were issues when debugging files and running tools using conda environments unless VS Code was initiated in an activated conda environment. The Python extension is using “conda run” to execute files and tools. It will solve the above-stated problem.
Some known issues are created when there are special characters in file paths, or when using custom command lines arguments in VS Code. The Anaconda team is already working out to solve this above-stated problem. But Microsoft has advised that if any user is experiencing any of the above-stated issues from now. The user should check and see if conda has been released with a fix, otherwise, the user should start VS Code from an activated conda environment from an external environment.
5. Other Enhancements in Python in VS Code 2022 Release
Besides the above stated four main improvements, some more enhancements have been added to increase users’ good experience. Some top enhancements are as stated below:
- Drop support for Python 3.6
- Added support for pylint error ranges.
- Updated Chinese-Taiwan translations.
- Fixed TypeScript and namespace errors.
- Improve unit tests for envVarsService.
- Improved select folder quickpick UI in multiroot workspaces.
How to Install Python extension 2022 Release in VS Code
So you must try the updated Python extension 2022 release by downloading the python extension from the Marketplace. You can also download it directly from the extensions view in Virtual Studio Code. Just press Ctrl+ Shift+ X from the keyboard to install the extension.
Which stated feature from above is more useful to you? Tell us in the comments below!!