如何在Visual Studio Code的多根工作区中启动复合任务?

时间:2019-02-28 22:26:22

标签: debugging visual-studio-code vscode-settings

我正在尝试在vscode中启动客户端和服务器。两项任务都可以独立运行。但是,我无法在工作空间配置中运行复合任务。

我的假设是,根据文档-https://code.visualstudio.com/docs/editor/multi-root-workspaces#_debugging

,工作区配置中的任务应出现在debug下拉启动菜单中。

这仅仅是vscode的错误还是我的配置有问题?以下是所有3个配置文件。

客户端launch.json

}
  "version": "2.0.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Start Client",
      "program": "${workspaceFolder}/src/index.ts",
      "outFiles": ["${workspaceFolder}/dist/**/*.js"],
      "console": "integratedTerminal"
    }
  ]
}

服务器launch.json

}
  "version": "2.0.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Start Server",
      "program": "${workspaceFolder}/src/index.ts",
      "outFiles": ["${workspaceFolder}/dist/**/*.js"],
    }
  ]
}

工作区配置

{
  "folders": [
    {
      "path": "client"
    },
    {
      "path": "server"
    }
  ],
  "launch": {
    "compounds": [
      {
        "name": "Server & Client",
        "configurations": [
          "Start Client",
          "Start Server"
        ]
      }
    ]
  }
}

1 个答案:

答案 0 :(得分:1)

几个小时后才找到答案。

"launch": {
    "configurations": [], // This line was needed
    "compounds": [
      {
        "name": "Server & Client",
        "configurations": [
          "Start Client",
          "Start Server"
        ]
      }
    ]
  }