vscode config for Bonsai debugging #7466
Open
+101
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is my first PR for Bonsai and I expect it might lead to some discussion.
Current guidelines
Current development guides recommend using the “Blender Development” VS Code extension. For Bonsai development this extension offers limited value:
Its primary function - symlinking an add-on repository into Blender’s installation directory - is already handled by
src/bonsai/scripts/dev_environment.py.Its debug workflow launches Blender with its own arguments and manages a debugpy server internally. This bypasses VS Code’s launch configurations and prevents correct source-path mapping between the Blender install tree and the repository tree.
A mentioned alternative is the lightweight hextant_python_debugger add-on, which supports custom launch configurations. However, it must be installed separately, and starting the debugpy server requires manual steps inside Blender each time it's started.
Proposed Change
This PR introduces:
launch.jsontasks.jsonsettings.jsonwith the correct Blender installation path and source-mapping configuration.The workflow becomes:
The launch configuration then attaches to Blender with full path mapping, ensuring that breakpoints resolve to files in the repository rather than the installation directory. It also enables reliable use of “Just My Code”.
Benefits
This PR intends to streamline and simplify the development and debugging experience for Bonsai developers.