I was able to generate a launch.json
file with the VSCode Rust debugger; The tool is smart enough to create a configuration array with multiple configurations, one for each package in my project; so far so good. Except that a Start Debugging
always choose the first configuration in the list.
Do I need to place the configuration I want to launch at the beginning of the array, or is there a way to specify a specific name in the list?
CodePudding user response:
Open the Run and Debug sidebar (, Ctrl/Cmd Shift D), and in the list choose the configuration to launch.
For one time, you can open the Command Palette (Ctrl/Cmd Shift P), and choose "Debug: Select and Start Debugging". Then choose the desired configuration.
If you want to bind it to a shortcut, edit your keybindings.json and add:
{
"key": /* shortcut, e.g. */ "ctrl alt k ctrl alt k",
"command": "debug.startFromConfig",
"args": /* full launch configuration. you cannot rely on configurations specified in launch.json, unfortunately */ {}
}
Unfortunately, there's no way to apply keybindings per-workspace. See A keybindings.json per workspace in Visual Studio Code.
See Allow key binding for individual launch configurations for more.