【问题标题】:Run custom commands as run configurations in Visual Studio Code在 Visual Studio Code 中运行自定义命令作为运行配置
【发布时间】:2021-02-23 11:44:25
【问题描述】:

我试图弄清楚如何在 Visual Studio Code 中进行自定义运行配置,但没有成功找到任何描述我的用例的文档。

我想创建一个运行配置来运行我可以设置为运行我的代码的任意命令。这是必要的,因为我使用的语言没有提供运行配置的扩展。

我确实发现任务可以做到这一点,但我不知道如何通过按 F5 来运行任务(就像使用运行配置一样)。

所以,这就是我想要做的:定义 something 当我按 F5 时将运行一个命令(run.exe ${currently selected VSCode file})。

【问题讨论】:

    标签: visual-studio-code vscode-debugger vscode-tasks


    【解决方案1】:

    定义这个任务

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

    重新定义keybindings.json中的F5键绑定

    { "key": "F5", "command": "-workbench.action.debug.start" },
    { "key": "F5", "command": "-workbench.action.debug.continue" },
    {
      "key": "F5",
      "command": "workbench.action.tasks.runTask",
      "args": "Run current"
    }
    

    【讨论】:

    • 第一个去哪里?
    • @Tuor 把它放在你的.vscode/tasks.json
    猜你喜欢
    • 2016-06-04
    • 1970-01-01
    • 2021-05-11
    • 2019-07-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-29
    相关资源
    最近更新 更多