【问题标题】:How can I launch compound tasks within a multi-root workspace in Visual Studio Code?如何在 Visual Studio Code 的多根工作区中启动复合任务?
【发布时间】:2019-02-28 22:26:22
【问题描述】:

我正在尝试在 vscode 中启动客户端和服务器。这两个单独的任务都可以自己正常工作。但是,我无法在工作区配置中运行复合任务。

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

这只是 vscode 的错误还是我的配置有问题?所有 3 个配置文件都在下面。

客户端启动.json

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

服务器启动.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"
        ]
      }
    ]
  }
}

【问题讨论】:

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


    【解决方案1】:

    找了几个小时才找到答案。

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

    【讨论】:

    • 天哪..这个小问题也是我的问题..遇到缺少配置时确实应该显示错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-03-05
    • 2021-03-17
    • 1970-01-01
    • 1970-01-01
    • 2018-01-08
    • 1970-01-01
    • 2016-05-24
    相关资源
    最近更新 更多