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.
Features
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.
Requirements
Ensure you have the latest version of Visual Studio Code installed.
Extension Settings
This extension contributes the following settings:
pythonTryCatchWrapper.indentation: Customize the indentation used for wrapping (default is a tab).
Usage
Highlight the Python code you want to wrap.
Press Ctrl+Shift+T.
The selected code will be wrapped in a try-except block.
Known Issues
Currently, the extension does not support multi-level indentation for nested code. Planned for future updates.