简体   繁体   中英

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?

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.

Edit:

As Requested i tried to do this

inside my.vscode folder i created a file named settings.json

with this as content

{
"env": {
    "dirLoc": "C:\\output\\"
    }
}

and tried to use this variable in my tasks.json file

        {
        "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.

The file can be plain text, key-value, json and yaml.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM