User12547645
User12547645

Reputation: 8477

How to use the same input string across multiple chained tasks in vscode?

I have multiple tasks that depend on each other and that should all operate on the same folder.

My config looks something like this:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "first task",
      "type": "shell",
      "command": "bash",
      "args": ["do stuff in ${input:pickFolder}"],
      "dependsOn": "second task"
    },
    {
      "label": "second task",
      "type": "shell",
      "command": "bash",
      "args": ["also do stuff in ${input:pickFolder}"]
    }
  ],
  "inputs": [
    {
      "type": "pickString",
      "id": "pickFolder",
      "options": ["path/to/folder", "path/to/other/folder"]
    }
  ]
}

As you might imagine I want both tasks run in the same folder. Also, I don`t want to have to pick the folder twice. How can I do that?

Upvotes: 0

Views: 750

Answers (1)

rioV8
rioV8

Reputation: 28763

You can use the extension Command Variable v0.9.

Use the commands:

  • extension.commandvariable.pickStringRemember
  • extension.commandvariable.rememberPick

Upvotes: 1

Related Questions