[英]Visual Studio Code User Individual Configuration for Project
I have a project created with defined tasks, for other users to use in my institution.我有一个使用定义的任务创建的项目,供其他用户在我的机构中使用。
But now one of my tasks needs a parameter that should be a user defined directory.但是现在我的一项任务需要一个参数,该参数应该是用户定义的目录。
How can each user have a configuration file in their project that my tasks can read and get the directory they want the out put to go?每个用户如何在他们的项目中拥有一个我的任务可以读取的配置文件,并获得他们想要输出到 go 的目录?
This is a example of my task:这是我的任务的一个例子:
{
"label": "Generate File",
"type": "shell",
"command": "cscript.exe",
"args": [
"//NoLogo",
"${workspaceFolder}/scripts/build.vbs",
"0",
"${output}",
],
"options": {
"cwd": "${workspaceFolder}"
},
The output should be a folder define by each of the users in a configuration or setting file they can put in their project. output 应该是每个用户在他们可以放入项目的配置或设置文件中定义的文件夹。
Edit:编辑:
As Requested i tried to do this按照要求我试着这样做
inside my.vscode folder i created a file named settings.json在 my.vscode 文件夹中,我创建了一个名为 settings.json 的文件
with this as content以此为内容
{
"env": {
"dirLoc": "C:\\output\\"
}
}
and tried to use this variable in my tasks.json file并尝试在我的 tasks.json 文件中使用此变量
{
"label": "Generate File",
"type": "shell",
"command": "cscript.exe",
"args": [
"//NoLogo",
"${workspaceFolder}/scripts/build.vbs",
"0",
"${env:dirLoc}",
],
"options": {
"cwd": "${workspaceFolder}"
},
but still i did not get anything in the value, it came blank但我仍然没有得到任何价值,它是空白的
You can use the extension Command Variable .您可以使用扩展命令变量。
It has the command extension.commandvariable.file.content
where you can read file content and use it in a variable in the task or launch.它具有命令extension.commandvariable.file.content
,您可以在其中读取文件内容并在任务或启动的变量中使用它。
The file can be plain text, key-value, json and yaml.该文件可以是纯文本、键值、json 和 yaml。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.