This Visual Studio Code extension allows you to quickly wrap selected Python code in a try-except block. It's designed to streamline error handling in your Python scripts by providing a convenient shortcut (Ctrl+Shift+T) to encase your code in a try-except structure.
Easy Try-Catch Wrapping: Select the code you want to wrap and press Ctrl+Shift+T to automatically wrap it in a try-except block.
Customizable Template: The default try-except block includes a basic error print statement. You can modify this template to suit your needs.
Ensure you have the latest version of Visual Studio Code installed.
This extension contributes the following settings:
pythonTryCatchWrapper.indentation: Customize the indentation used for wrapping (default is a tab).
Highlight the Python code you want to wrap.
The selected code will be wrapped in a try-except block.
Currently, the extension does not support multi-level indentation for nested code. Planned for future updates.