I’m unable to set default values for input variables of type pickStringRemember and promptStringRemember in VSCode with the “Command Variable”-Extension.
I successfully passed input variables from launch.json to task.json in VSCode with the following configuration:
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/app.js ${input:ChooseModule} ${input:ChooseBaseNode}",
"preLaunchTask": "Build"
},
],
"inputs": [
{
"id": "ChooseModule",
"type": "command",
"command": "extension.commandvariable.pickStringRemember",
"args": {
"key": "Module",
"options": [
"ModuleA.py",
"ModuleB.py",
"ModuleC.py",
],
"description": "Choose a Module"
},
},
{
"id": "ChooseBaseNode",
"type": "command",
"command": "extension.commandvariable.promptStringRemember",
"args": {
"key": "BaseNode",
"description": "Base node",
}
},
]
}
task.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"command": "python",
"args": [ "build.py", "${input:ChooseModule}", "${input:ChooseBaseNode}" ],
},
],
"inputs": [
{
"id": "ChooseModule",
"type": "command",
"command": "extension.commandvariable.remember",
"args": {
"key": "Module",
}
},
{
"id": "ChooseBaseNode",
"type": "command",
"command": "extension.commandvariable.remember",
"args": {
"key": "BaseNode"
}
}
]
}
Launching the program, selecting “ModuleA” as Module and entering “Node1” as Node results in the line
“Executing task: python build.py ModuleA.py Node1”
in the Terminal, so the variables are passed successfully!!
Now I tried to set “ModuleC.py” and “Node2” as default values for the pick and the prompt with the following changes:
task.json:
...
"options": [
"ModuleA.py",
"ModuleB.py",
"ModuleC.py",
],
"default": "ModuleC.py",
"description": "Choose a Module"
...
...
"key": "BaseNode",
"default": "Node2"
"description": "Base node",
...
I expected to see the “ModuleC” item selected and on top of the pick-list (as it works with plain “pickString”) and “Node2” selected and entered in the input field. But that’s not the case! Neither the pick-list nor the input field shows the default values.
Whats wrong with my code ?