在vscode中,我有一个包含多个配置的launch.json文件。是否有办法为特定的配置分配键盘快捷键?我没有找到相关信息,谢谢!
launch.json
中的任何启动配置设置按键绑定。如果需要,可以为不同的启动配置设置多个按键绑定。示例设置(在您的settings.json
中): "launches": {
"RunNodeCurrentFile": "Launch File",
"RunCompound1": "Launch file and start chrome"
},
使用这个扩展程序,你可以将你想要运行/调试的launch.json配置文件中的值设置为name
。然后在你的keybindings.json
中设置按键绑定来触发这些配置。
{
"key": "alt+f",
"command": "launches.RunNodeCurrentFile"
},
{
"key": "alt+g",
"command": "launches.RunCompound1"
}
{
"key": "alt+j", // whatever keybinding you like
"command": "debug.startFromConfig",
"args": {
"type": "node",
"request": "launch",
"name": "First Debugger",
"program": "${workspaceFolder}/test.js",
"console": "integratedTerminal",
//"preLaunchTask": "echo Builtin Variables" // can't get it to find a pre-launch task
}
}
但很遗憾,不能简单地通过引用现有的配置文件launch.json
来实现-例如,通过name
。所引用的配置文件-这里是First Debugger
,可以存在于您的launch.json
中,但不一定要存在。无论如何,所有的args
都必须出现在您的键绑定中。
workbench.action.debug.run
,而不是 启动/停止/重新启动调试
选项? - Mark