VSCode任务用户输入中的预定义变量替换

时间:2019-01-22 12:43:01

标签: visual-studio-code vscode-tasks

看着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"
      }
   ]
}

1 个答案:

答案 0 :(得分:0)

此问题表明inputs当前不支持变量替换,但将来可能会添加它:

consider to allow for variable substitution in the inputs section (#64358)