Python in Visual Studio Code – December 2020 Release

Savannah

We are happy to announce that the December 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.  

In this release we closed 13 issues, and it includes:  

  • Extract method and variable code actions with Pylance
  • Pylance insiders program 
  • Ipywidgets support in Native Notebooks   

If you’re interested, you can check the full list of improvements iour changelog. 

Pylance Extract Method & Variable Code Actions 

We are excited to announce that extract code actions are available in Pylance 2020.12.2 or later! These new code actions allow you to highlight lines of code and automatically refactor and extract them into new methods or variables at the click of a button! If you still haven’t given our new language server a try, you can download it from the marketplace or simply set python.languageServer: “Pylance” in your settings.json and we will prompt you to install it! 

Method extraction with Pylance in VS Code.

Variable extraction with Pylance in VS Code.

Pylance Insiders 

Pylance now features an Insiders program, which offers early access to new language server features and improvements. To enable insiders, setpylance.insidersChannel“: “daily”. This will enable a daily check for new builds. At startup or when the insiders setting is changed, Pylance will automatically update and prompt you to reload. To leave the insiders program, remove the setting, or explicitly set pylance.insidersChannel“: “off”. You may be prompted to downgrade your extension to the latest stable version.  

Image Dec2020 PylanceInsiders

Ipywidget Support in Native Notebooks  

The Jupyter Extension now supports ipywidgets in our Native Notebooks experience in VS Code Insiders! This means that you can now bring all your favorite interactive plotting libraries such as beakerXbqplot, and many more, to visualize and interact with data in our Insider’s experience.  

Ipywidget rendering on a Jupyter notebook in VS Code Insiders.

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: 

  • Completion suggestions are now matched more fuzzily. (pylance-release#608) 
  • Fix for __file__ variable not set after restarting kernel in the interactive window. (vscode-jupyter#1373)
  • Format .pyi files correctly when using Black. (thanks Steve Dignam!) (#13341) 
  • Modified the errors generated when launch.json is not properly configured to be more specific about which fields are missing. (thanks Shahzaib Paracha!) (#14739)

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. 

 

11 comments

Comments are closed. Login to edit/delete your existing comments