Emobe
Emobe

Reputation: 712

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

I am trying to launch both a client and a server within vscode. Both of the individual tasks work fine on their own. However, I am not able to run the compound task within the workspace configuration.

My assumption is that the task from the workspace config should appear in the debug dropdown launch menu as per the documentation - https://code.visualstudio.com/docs/editor/multi-root-workspaces#_debugging

Is this just a bug with vscode or is something wrong with my config? All 3 config files are below.

Client 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"
    }
  ]
}

Server launch.json

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

Workspace Config

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

Upvotes: 2

Views: 2330

Answers (1)

Emobe
Emobe

Reputation: 712

Just found the answer after hours of looking.

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

Upvotes: 7

Related Questions