Python in Visual Studio Code – September 2020 Release
We are pleased to announce that the September 2020 release of the Python Extension for Visual Studio Code is now available. You can download the Python extension from the Marketplace, or install it directly from the extension gallery in Visual Studio Code. If you already have the Python extension installed, you can also get the latest update by restarting Visual Studio Code. You can learn more about Python support in Visual Studio Code in the documentation.
This was a short release where we addressed total of 34 issues, and it includes support for colorization and auto import improvements with Pylance, our new language server extension for Python in VS Code.
If you’re interested, you can check the full list of improvements in our changelog.
Support for semantic colorization in Pylance
We are exciting to announce that you can now get support for semantic colorization with Pylance, helping to improve the readability of your code. Semantic colorization is an extension on syntax highlighting. Pylance generates semantic tokens which are used by themes to apply colors based on the semantic meaning of symbols (e.g. variables, functions, modules all have different colors applied to them). To see this new feature in action, you’ll need to apply a theme that supports semantic color. Some great themes to try out semantic colorization are the built-in Dark+ theme or One Dark Pro.
Check out the before and after on this code sample with semantic colorization!
Pylance auto-import improvements
With improved auto-import completions, you can now see a clearer preview of the import statement that will be added to your file in the completion tooltip. The way that Pylance adds imports to your file has also been improved by detecting when you’ve already imported other submodules or functions from that module. Instead of adding a duplicate import statement to your file, Pylance will now amend the existing one by adding the symbol alphabetically in the statement, helping to keep your imports organized.
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:
- Live reload is now on by default for Flask and Django debug configuration (thanks ian910297!) (#13061)
- Upgrade isort to 5.5.2. (#13831)
- Drop support for Python 3.5 (it reached end-of-life in September 2020 and isort 5 does not support it). (#13459)
We’re constantly A/B testing new features. If you see something different that was not announced by the team, you may be part of the experiment! To see if you are part of an experiment, you can check the first lines in the Python extension output channel. If you wish to opt-out of A/B testing, you can open the user settings.json file (View > Command Palette… and run Preferences: Open Settings (JSON)) and set the “python.experiments.enabled” setting to false.
Be sure to download the Python extension for Visual Studio Code now to try out the above improvements. If you run into any problems or have suggestions, please file an issue on the Python VS Code GitHub page.