VSCode Run Launch configuration via Tasks.json

Viewed 366

I currently have a tasks.json that runs 3 tasks together, grouped in a panel on folder startup:

tasks.json

{
"version": "2.0.0",
"tasks": [
  {
    "label": "Run dev",
    "type": "shell",
    "command": "npm run dev",
    "presentation": {
      "reveal": "always",
      "panel": "new",
      "group": "develop",
    },
    "runOptions": { "runOn": "folderOpen" }
  },
  {
    "label": "Run css",
    "type": "shell",
    "command": "npm run watch:css",
    "presentation": {
      "reveal": "always",
      "panel": "new",
      "group": "develop",
    },
    "runOptions": { "runOn": "folderOpen" }
  },
  {
    "label": "Run tunnel",
    "type": "shell",
    "command": "npm run tunnel",
    "presentation": {
      "reveal": "always",
      "panel": "new",
      "group": "develop",
    },
    "runOptions": { "runOn": "folderOpen" }
  },
  {
    "label": "Start Dev",
    "dependsOn": [
      "Run dev",
      "Run css",
      "Run tunnel"
    ],
    "problemMatcher": []
  }
]
}

What i'm looking to do is move Run dev to a launch configuration instead so I have debugging enabled by default, and keep the same terminal experience:

launch.json

{
"configurations": [
{
    "name": "Run npm run dev",
    "command": "npm run dev",
    "request": "launch",
    "type": "node-terminal",
    "cwd": "${workspaceFolder}",
    "console": "internalConsole",
    "serverReadyAction": {
        "pattern": "started at http://localhost:([0-9]+)",
        "uriFormat": "http://localhost:%s",
        "action": "openExternally"
    }
}
]
}

So the end result will be the same 3 tasks, but "Run dev" triggers the "Run npm run dev" launch configuration in it's terminal window

The problem is there doesn't seem to be a way to do this?

0 Answers
Related