diff --git a/src/toolchain/debugging.md b/src/toolchain/debugging.md index d8b45a8..1eff3d5 100644 --- a/src/toolchain/debugging.md +++ b/src/toolchain/debugging.md @@ -17,32 +17,46 @@ you will only have symbols for stack frames in Rust code. ## Launching with VS Code -Here is an example launch configuration for Visual Studio Code. Launch configurations should be added to `./.vscode/launch.json`, relative -to your project's root. This example assumes you have the [CodeLLDB] extension installed, which is common for Rust development. +Here is an example debugger setup for Visual Studio Code. Launch configurations and tasks should be placed in`./.vscode/launch.json` and +`./.vscode/tasks.json` respectively, relative to your project's root. + +This example assumes you have the [CodeLLDB] extension installed, which is common for Rust development. + +For commands like `-w` (windowed mode) or `-e` (editor), refer to Godot's [command line tutorial][godot-command-line]. ```json +// ./.vscode/launch.json { "configurations": [ { "name": "Debug Project (Godot 4)", "type": "lldb", // type provided by CodeLLDB extension "request": "launch", - "preLaunchTask": "rust: cargo build", - "cwd": "${workspaceFolder}", + "cwd": "${workspaceFolder}/godot", + "preLaunchTask": "build-rust", + "args": [ + "-w" // windowed mode + // "-e": editor does not keep breakpoints; thus not listed here. + ], + "program": "PATH/TO/GODOT" + } + ] +} +``` + +```json +// ./.vscode/tasks.json +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build-rust", + "command": "cargo", "args": [ - "-e", // run editor (remove this to launch the scene directly) - "-w", // windowed mode + "build" ], - "linux": { - "program": "/usr/local/bin/godot4", - }, - "windows": { - "program": "C:\\Program Files\\Godot\\Godot_v4.1.X.exe", - }, - "osx": { - // NOTE: on macOS the Godot.app needs to be manually re-signed - // to enable debugging (see below) - "program": "/Applications/Godot.app/Contents/MacOS/Godot", + "options": { + "cwd": "${workspaceFolder}/rust" } } ] @@ -97,3 +111,4 @@ in Terminal to complete the re-signing process. It is recommended to check this re-sign their local installation if you have a team. This process should only be necessary once per Godot installation though. [CodeLLDB]: https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb +[godot-command-line]: https://docs.godotengine.org/en/latest/tutorials/editor/command_line_tutorial.html#command-line-reference