microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.59k stars 29.03k forks source link

More flexible input variables: Multiple values & labels #68397

Open mdschweda opened 5 years ago

mdschweda commented 5 years ago

I love the new input variables feature and was eager to thin out the tasks lists of my projects. Unfortunately, I realized that the mechanism does not suffice for most cases. Items of the options array may be cryptic ids and often a choice represents a combination of variables. May I suggest that you support multiple values and, consequently, labels?

Example:

{
  "tasks": [{
    "label": "🐳 Docker build",
    "type": "shell",
    "command": "docker",
    "args": ["build", "-t", "${input:image.tag}", "."],
    "options": {
      "cwd": "${workspaceFolder}/${input:image.context}"
    },
    "problemMatcher": []
  }],
  "inputs": [{
    "id": "image",
    "type": "pickString",
    "description": "Which image to build?",
    "options": [{
      "label": "💵 Billing",
      "value": {
        "tag": "my.azurecr.io/myshop-billing",
        "context": "backend/services/billing"
      }
    }]
  }]
}

Valid values might be:

{
  "options": [
    "a string",
    { "value": "with a", "label": ":)" },
    { "label": "with multiple", "value": { "s": "" } }
  ]
}
hanfengcan commented 5 years ago

I have the same need, options add label 👍

ThaDaVos commented 1 year ago

Any progress on this? I am also looking to thin out my tasks.json - and really missing these options

wolfspyre commented 5 months ago

agreed.

I'd really like to be able to have a mechanism of selecting one pickString matcher/label and be able to declare multiple variables usable in the corresponding task...

  "inputs": [{
    "id": "image",
    "type": "pickString",
    "description": "Which image to build?",
    "options": [{
      "label": "💵 Billing",
      "value": {
        "tag": "my.azurecr.io/myshop-billing",
        "context": "backend/services/billing"
      }
    }]
  }]

describes this sufficiently imo... so I won't try to reword the OP's request.

Is there anything which could be done to elevate the priority of this backlogged task?

it really would be quite nice.