Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Import Settings

Marcel Kloubert edited this page Jun 13, 2021 · 1 revision

External files

The global setting imports can define one or more paths of external files, which are merged with the data of the settings.json file in the .vscode sub folder.

{
    "ego.power-tools": {
        "imports": [
            "relative/to/settings/file.json",
            "/full/path/to/settings.json"
        ]
    }
}

Imported setting files must have the same structure as the settings.json.

Relative paths will be mapped to the .vscode sub folder of the workspace or the .vscode-powertools sub folder inside the current user's home directory.

If a file cannot be found, the entry is ignored and NO error is thrown.

Values

Many settings support an importValues property, which, when defined, imports values to their properties from external values.

The following example, will import the buttonText and buttonTooltip values to the text and tooltip properties of the declared button.

{
    "ego.power-tools": {
        "buttons": [
            {
                "importValues": {
                    "text": "buttonText",
                    "tooltip": "buttonTooltip"
                },

                "action": {
                    "type": "script",
                    "script": "my_button.js"
                }
            }
        ],

        "values": {
            "buttonText": "My button",
            "buttonTooltip": {
                "type": "code",
                "code": " 'This is a tooltip' + ' for the button, generated by code' "
            }
        }
    }
}