Jos*_*ode 3 json visual-studio-code vscode-tasks vscode-debugger
我试图弄清楚如何在 Visual Studio Code 中进行自定义运行配置,但没有成功找到任何描述我的用例的文档。
我想创建一个运行配置来运行我可以设置来运行我的代码的任意命令。这是必要的,因为我使用的语言没有提供运行配置的扩展。
我确实发现这对于任务是可能的,但我无法弄清楚如何通过按 F5 来运行任务(就像使用运行配置一样)。
所以,这就是我想要做的:定义当我按 F5 时将运行命令(run.exe ${当前选择的 VSCode 文件})的内容。
定义这个任务并将其放入.vscode/tasks.json:
{
"label": "Run current",
"type": "shell",
"command": "run.exe ${file}"
}
Run Code Online (Sandbox Code Playgroud)
然后添加一个F5键绑定keybindings.json
{ "key": "F5", "command": "-workbench.action.debug.start" },
{ "key": "F5", "command": "-workbench.action.debug.continue" },
{
"key": "F5",
"command": "workbench.action.tasks.runTask",
"args": "Run current"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4389 次 |
| 最近记录: |