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

编程入门 行业动态 更新时间:2024-10-27 02:18:46
本文介绍了VSCode任务用户输入中的预定义变量替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

查看有关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任务用户输入中的预定义变量替换

本文发布于:2023-10-14 11:44:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1490962.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:变量   用户   VSCode

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!