看着documentation for VSCode variable substitution,我期望下面的tasks.json
在使用chooseDirectory
代码时在选择列表中执行变量替换,但是它只是选择文字字符串{{1 }}。
我可以让替换文本显示在用户选择菜单中吗?
${fileDirname}
执行任务时,将执行以下操作:
{
"version": "2.0.0",
"command": "cmd",
"args": ["/c"],
"tasks": [
{
"label": "The task",
"command": "my_batch_file.bat",
"type": "shell",
"args": [
"${workspaceFolder}",
"${input:chooseDirectory}"
],
"problemMatcher": []
}
],
"inputs": [
{
"id": "chooseDirectory",
"description": "Select the Directory",
"type": "pickString",
"options": ["option1", "${fileDirname}"],
"default": "option1"
}
]
}
答案 0 :(得分:0)
此问题表明inputs
当前不支持变量替换,但将来可能会添加它:
consider to allow for variable substitution in the inputs section (#64358)