如何在 Visual Studio 代码中的多根工作空间中启动复合任务?

How can I launch compound tasks within a multi-root workspace in Visual Studio Code?

我正在尝试在 vscode 内同时启动客户端和服务器。这两项单独的任务都可以独立完成。但是,我无法 运行 工作区配置中的复合任务。

我的假设是,根据文档,工作区配置中的任务应该出现在调试下拉启动菜单中 - https://code.visualstudio.com/docs/editor/multi-root-workspaces#_debugging

这只是 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"
        ]
      }
    ]
  }
}

经过几个小时的寻找才找到答案。

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