Thursday, February 3, 2022

Python Engineering at Microsoft: 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.

Smart Selection

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.

Expanding and shrinking code selection with keyboard short keys for smart selection. Theme: Monokai – High Contrast

Folding support

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.

Folding and expanding sections of code in the editor 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:

List of interpreters grouped by type: workspace, venv, conda, pyenv and global.

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:

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.

The post Python in Visual Studio Code – February 2022 Release appeared first on Python.



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...