You can use input variables
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File with arguments",
"type": "python",
"request": "launch",
"program": "${file}",
"args": [
"--dir",
"/some/fixed/dir/${input:enterDir}"
]
}
],
"inputs": [
{
"id": "enterDir",
"type": "promptString",
"description": "Subdirectory to process",
"default": "data-0034"
}
]
}
You can place the ${input:enterDir}
in any string in the task "configurations"
like the "cwd"
property.
If you like to pick a directory from a list because it is dynamic you can use the extension Command Variable
that has the command pickFile
Command Variable v1.36.0 supports the fixed
folder specification.
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File with arguments",
"type": "python",
"request": "launch",
"program": "${file}",
"args": [
"--dir",
"${input:pickDir}"
]
}
],
"inputs": [
{
"id": "pickDir",
"type": "command",
"command": "extension.commandvariable.file.pickFile",
"args": {
"include": "**/*",
"display": "fileName",
"description": "Subdirectory to process",
"showDirs": true,
"fromFolder": { "fixed": "/some/fixed/dir" }
}
}
]
}
On Unix like systems you can include the folder in the include
glob pattern. On Windows you have to use the fromFolder
to convert the directory path to a usable glob pattern. If you have multiple folders you can use the predefined
property.