Changes In Python Extension For Visual Studio Code

Microsoft’s July 2021 release of the Python Extension for Visual Studio Code is now available for download with many notable changes. Namely, providing a faster way to configure project roots via a new Pylance quick fix, Python interpreter selection no longer changes settings, and new debugger features.

The new Pylance quick fix allows for a timely configuration of Python project roots.  Previously, diagnostics were found under import statements with no way to resolve them, and users had to adjust setting python.analysis.extraPaths. Now, hovering over the diagnostic on the import statement and clicking the lightbulb icon or “Quick Fix” in the tooltip allows Pylance to suggest paths to add to python.analysis.extraPaths.

Changing a Python interpreter previously updated the python.pythonPath setting with the interpreter as its value. This was problematic as people could not share machine specific codes in GitHub repos. Python will now store the interpreter information in internal storage, not changing settings.json. This can be seen by running the “Python: Select Interpreter” command and identifying the value of the “current” field or by opening the Python outlet panel.

The two new debugging features allow users to choose which targets to step into when there is more than one option by specifying a target at a breakpoint. The second feature allows users to inspect a specific functions behavior by specifying its name on the breakpoint window.