Answer a question

I'm trying to figure out how to make a custom run configuration in Visual Studio Code, and am not succeeding in finding any documentation describing my use case.

I want to make a Run Configuration that runs arbitrary commands that I can set to run my code. This is neccecary because the language I am using doesn't have extensions providing run configurations.

I did find that this is possible with tasks, but I cannot figure out how to run a task by pressing F5 (like you would with a run configuration).

So, this is what I am looking to do: Define something that will run a command (run.exe ${currently selected VSCode file}) when I press F5.

Answers

Define this task

    {
      "label": "Run current",
      "type": "shell",
      "command": "run.exe ${file}"
    }

Redefine the F5 keybinding in 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"
}
Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐