Support pickStringRemember options from task result
I'm attempting to setup some remote debugging to kubernetes containers which requires me to ask the user for the pod name they wish to debug. The pod names will need to be obtained from the kubernetes cluster on demand as they are not static information. I currently use a task to query the cluster and emit a "podnames.txt" file containing single-line, name-value pairs. This allows a pickStringRemember to use the fileName arg and list pods to choose from.
{
"id": "podName",
"type": "command",
"command": "extension.commandvariable.pickStringRemember",
"args": {
"description": "Which pod do you want to debug?",
"options": [],
"fileName": "${workspaceFolder}\\.vscode\\podnames.txt",
"pattern": {
"regexp": "^\\s*(?!#)([^=]+?)\\s*=\\s*(?:(\\{.+\\})|(.+))$",
"label": "$1",
"json": "$2",
"value": "$3"
}
}
}
Now, what I would like to happen is when the developer selects to attach the debugger the "podName" input should use the most current list of pods. I started with using a preLaunchTask to kick off the task but it would appear the input process is executed before the task so a bit of chicken and egg thing going on.
What I guess I'm after is if pickStringRemember could source its options content direct from a task. Is this possible some way, or is there another solution to my problem?
You can create a combined command with multi-command and Launch Configs.
You can use the commands from "Launch Configs" also in "multi-command".
Create a combined command:
- run a named task with the command:
workbench.action.tasks.runTask - launch your debug config with "Launch Configs"
You can create a keybinding for this combined command on any key combo like: Ctrl+Shift+Alt+F5
I don't know if workbench.action.tasks.runTask waits till the task is finished.
@rioj7 I'll give it a shot and see what user experience is like. Thank you.
As for right now, it just requires the developer to run the List Pods task first before launching a debug attach, else they get an empty list, or an old one if they happened to have redeployed the containers. It should be fairly obvious (after a few iterations) from the message in the debug console that they need to run the task again. Still, one step would be better.