Tech

Python Extension for Visual Studio Code gets pinpoint debugging

The monthly update of the Python Extension for Visual Studio Code has been released. The extension from Microsoft has new functions for the source code editor’s handling of Python code on board, including new features for debugging and extended Jedi support. The latest version of the extension can be obtained either from the Visual Studio Code Marketplace or directly from the Extension Gallery in Visual Studio Code. If the extension is already installed, a restart of Visual Studio Code is sufficient.

In the current release of the Python extension, two additional options are available for debugging. The first is the ability for developers to choose which target they want to step into on a line of code when multiple options are available. This is useful in this case, for example:


 Python Extension for Visual Studio Code: mögliche Targets im Python-Debugger

 Python Extension for Visual Studio Code: mögliche Targets im Python-Debugger

Python Extension for Visual Studio Code: mögliche Targets im Python-Debugger

(Image: Microsoft)

Up until now, it was necessary to enter and step out of the unwanted code sections until the desired, for example, the call generate_wordcloud, was achieved. This will no longer apply with the July release, because the target can now be selected directly:


Python Extension for Visual Studio Code: Auswahl des Targets im Python-Debugger

Python Extension for Visual Studio Code: Auswahl des Targets im Python-Debugger

Python Extension for Visual Studio Code: Auswahl des Targets im Python-Debugger

(Image: Microsoft)

The second new debugging feature are function breakpoints. They come into play when it comes to investigating only the behavior of a specific function. To do this, select their name in the breakpoint window. The debugger then stops executing the code as soon as the named function is reached.

Another innovation is a quick fix for resolving previously unclear import statements in new projects. So far, manual settings were on python.analysis.extraPaths required to show Pylance the correct search paths for the import in order to get information needed for IntelliSense. Instead, Pylance, Microsoft’s Language Server for the popular Python programming language, now independently displays suggestions for search paths. This is done either by clicking on the lightbulb or by selecting “Quick Fix …” in the tooltip.

In addition, it is now possible to rename modules with the Python analysis tool Jedi, which previously led to an error. Some additional bugs have also been fixed with the update.

For more information on the latest edition of the Python Extension for Visual Studio Code, see found in a blog post.


(May)

To home page

.