简体   繁体   English

项目的 Visual Studio Code 用户个人配置

[英]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.

相关问题 Visual Studio代码的配置 - Configuration of Visual Studio Code Visual Studio 代码中的 pylintrc 配置 - pylintrc configuration in visual studio code Visual Studio Code 运行单个.cs 文件 - Visual Studio Code run individual .cs files Visual Studio Code 错误:“在根目录中找不到项目。请创建一个项目文件并将其添加到配置中。” - Visual Studio Code error: "No project found in root directory. Please create a project file and add it to the configuration." 设置包含c / c ++的路径 - 相对于Visual Studio代码中的工作空间路径的项目(.json配置) - Set include paths of c/c++-project relative to workspace path in Visual Studio Code (.json configuration) 什么是Visual Studio Code中的Visual Studio Configuration Manager等效项? - What is the equivalent of Visual Studio Configuration Manager in Visual Studio Code? Linux的Visual Studio代码扩展配置错误 - Visual Studio Code extension configuration error with Linux 未找到Visual Studio代码的ESLint配置 - No ESLint configuration found for Visual Studio Code Visual Studio代码缩进配置和EditorConfig? - Visual Studio Code Indent Configuration & EditorConfig? Python Visual Studio 代码 autoDocstring 配置 - Python Visual Studio Code autoDocstring Configuration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM