Python in Visual Studio Code – August 2019 Release

Avatar

Luciana

We are pleased to announce that the August 2019 release of the Python Extension for Visual Studio Code is now available. You can download the Python extensionfrom 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 made improvements that are listed in our changelog, closing a total of 76 issues including Jupyter Notebook cell debugging, introducing an Insiders program, improvements to auto-indentation and to the Python Language Server. 

Jupyter Notebook cell debugging  

A few weeks agowe showed a preview of debugging Jupyter notebooks cells at EuroPython 2019. We’re happy to announce we’re officially shipping this functionality in this release.  

Now you’ll be able to set up breakpoints and click on the “Debug Cell” option that is displayed at the cell definition. This will initiate a debugging session and you’ll be able to step into, step out and step over your code, inspect variables and set up watches, just like you normally would when debugging Python files or applications.   

Insiders program  

This release includes support for an easy opt-in to our Insiders program. You can try out new features and fixes before the release date by getting automatic installs for the latest Insiders builds of the Python extension, in a weekly or daily cadence.   

To opt-in this program, open the command palette (View Command Palette…) and select “Python: Switch to Insiders Weekly Channel”. You can also open the settings page (File Preferences Settings)look for “Python: Insiders Channel and set the channel to “daily” or “weekly”, as you prefer 

Improvements to auto-indentation

This release also includes automatic one level dedent and indentation for a series of statements on enter such as else, elif, except, finally, break, continue, pass and raise. This was another highly requested feature from our users 

Improvements to the Python Language Server

We’ve added new functionality to “go to definition” with the Python Language Serverwhich now takes you to the place in code where a variable (as an example) is actually defined. To match the previous behavior of “go to definition”, we added go to declaration.   

We’ve also made fixes to our package watcher. Before, whenever you added an import statement for a package you didn’t have installed in your environment, installing the package via pip didn’t fix ‘unresolved imports’ errors and a user would be forced to reload their entire VS Code window. Now, you no longer need to do this – the errors will automagically disappear once a new package is installed and analyzed. 

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: 

  • Add new ‘goto cell’ code lens on every cell that is run from a file. (#6359) 
  • Fixed a bug in pytest test discovery. (thanks Rainer Dreyer) (#6463) 
  • Improved accessibility of the ‘Python Interactive’ window. (#5884) 
  • We now log processes executed behind the scenes in the extension output panel. (#1131) 
  • Fixed indentation after string literals containing escaped characters. (#4241) 

We also started 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 from A/B testing, disable telemetry in Visual Studio Code. 

Be sure to download the Python extension for Visual Studio Code now to try out the above improvements. If you run into any problems, please file an issue on the Python VS Code GitHub page. 

Avatar
Luciana de Melo e Abud

Program Manager, Python extension in Visual Studio Code

Follow Luciana   

1 Comments
Avatar
Andreas Scheucher 2019-08-12 02:29:39
Sorry to say, the way the indentation works is completly counter productive. I have following issues: * Wrong intendation on pressing ENTER in an empty line on any indentation level* Wrong intendation on copy & paste. Indentation of the pasted code is always wrong* Wrong intendation on the block behind the pasted code* ... I really can't remember on how many ways this broke my former working code the last days. I spend somtimes more time to fix code than to code. For me the only solution had been to downgrade to the former version of the python plugin: https://stackoverflow.com/a/53755378/375251 Please assure the indentation works again as in the last version, as this was really productive and really worked.