News

Python in Visual Studio Code Enhances Debugging

The December 2023 update to Python in Visual Studio Code introduces several new features, including configurable debugging options that are now available on the Run button menu.

Microsoft's dev team for Python functionality in VS Code maintains the Python, Pylance and Jupyter extensions, which happen to be the three most popular tools in the code editor's marketplace, accounting for some 258 million installs.

Most Popular VS Code Extensions
[Click on image for larger view.] Most Popular VS Code Extensions (source: VS Code Marketplace).

Along with those tools is the Python Debugger extension provided as an optional installation, and this is where the configurable debug options under the Run button menu are now available.

"When you select Python Debugger: Debug using launch.json and there is an existing launch.json in your workspace, it shows all available debug configurations you can pick to start the debugger. In the case you do not have an existing launch.json, you will be prompted to select a debug configuration template to create a launch.json file for your Python application, and then can run your application using this configuration," Microsoft said in a Dec. 7 announcement. That's illustrated in this animated GIF:

Configurable Debugging Options in Action
[Click on image for larger view.] Configurable Debugging Options in Action (source: Microsoft).

Other tweaks in the new update include the ability to show type hierarchy when using the Pylance tool, which serves as the language server for VS Code, providing all the Python-specific functionality. The new ability to more conveniently explore and navigate through a Python projects’ types relationships can be helpful when working with large codebases with complex type relationships, Microsoft said.

The update also includes an experimental feature that introduces a new activation mechanism that can activate a selected environment in a developer's default terminal without requiring any explicit activation commands.

In response to community feedback, the dev team also added support for the deactivate command when the selected default terminal is PowerShell or the Command Prompt, with support for more terminals planned.

The other main feature highlighted by the team concerns the Python REPL, standing for Read, Evaluate, Print, and Loop. It's where developers can try out different code constructs to immediately see the effect of changes.

"When attempting to use Smart Send via kbstyle(Shift+Enter) on a Python file that contains unsupported Python code (e.g., Python 2 source code), there is now a warning message and a setting to deactivate REPL Smart Send," the team said. "Users are also able to change their user and workspace specific behavior for REPL Smart Send via the python.REPL.enableREPLSmartSend setting."

Many other tweaks were made, and they, along with more information about all of the above, can be found in the changelogs for the Python, Jupyter and Pylance extensions.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • IDE Irony: Coding Errors Cause 'Critical' Vulnerability in Visual Studio

    In a larger-than-normal Patch Tuesday, Microsoft warned of a "critical" vulnerability in Visual Studio that should be fixed immediately if automatic patching isn't enabled, ironically caused by coding errors.

  • Building Blazor Applications

    A trio of Blazor experts will conduct a full-day workshop for devs to learn everything about the tech a a March developer conference in Las Vegas keynoted by Microsoft execs and featuring many Microsoft devs.

  • Gradient Boosting Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the gradient boosting regression technique, where the goal is to predict a single numeric value. Compared to existing library implementations of gradient boosting regression, a from-scratch implementation allows much easier customization and integration with other .NET systems.

  • Microsoft Execs to Tackle AI and Cloud in Dev Conference Keynotes

    AI unsurprisingly is all over keynotes that Microsoft execs will helm to kick off the Visual Studio Live! developer conference in Las Vegas, March 10-14, which the company described as "a must-attend event."

  • Copilot Agentic AI Dev Environment Opens Up to All

    Microsoft removed waitlist restrictions for some of its most advanced GenAI tech, Copilot Workspace, recently made available as a technical preview.

Subscribe on YouTube