查看有关VSCode变量替换的文档,我期望使用chooseDirectory代码时,紧随tasks.json之后在选择列表中执行变量替换,但它只是选择文字字符串${fileDirname}.
Looking at the documentation for VSCode variable substitution, I was expecting the following tasks.json to perform variable substitution in the pick list when using the chooseDirectory code, but it just selects the literal string ${fileDirname} instead.
我可以让替换文本显示在用户选择菜单中吗?
Can I get the substituted text to appear in the user selection menu?
{ "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" } ] }执行任务时,将执行以下操作:
When the task executes, this is what gets executed:
> Executing task: my_batch_file.bat C:\My\Workspace\Directory ${fileDirname} <推荐答案
此问题表明inputs当前不支持变量替换,但将来可能会添加它:
This issue suggests that variable substitution is currently not supported for inputs, but might be added sometime in the future:
考虑允许在输入部分(#64358)进行变量替换
更多推荐
VSCode任务用户输入中的预定义变量替换
发布评论