Startups - egodigital/vscode-powertools GitHub Wiki

Startups are similar to Autostart in Windows.

They make it possible to define tasks, as scripts or shell commands, which are executed after a (new) workspace has been loaded (or its configuration has been changed).

Create a startup section to the settings.json file in the .vscode sub folder of your workspace and add one or more entry:

{
    "ego.power-tools": {
        "startup": [
            {
                "type": "script",
                "script": "my_startup.js"
            }
        ]
    }
}

For that example, create a my_startup.js file in your .vscode folder and use the following skeleton:

exports.execute = async (args) => {
    // args => https://egodigital.github.io/vscode-powertools/api/interfaces/_contracts_.scriptcommandstartuparguments.html

    // s. https://code.visualstudio.com/api/references/vscode-api
    const vscode = args.require('vscode');

    vscode.window.showInformationMessage(
        'Hello, new workspace!'
    );
};

Settings

Name Description Required?
if (JavaScript) Code that checks if startup is available or not. s. Conditional Settings no
importValues Defines a list of properties, which uses (external) values for itself. s. Import Settings no
platforms A list of one or more platform IDs, where the startup should be run on. s. process.platform no
type The type. Currently supports: script and shell. Default: shell no

Scripts

Runs a Node.js based script file.

{
    "ego.power-tools": {
        "startup": [
            {
                "type": "script",
                "script": "my_startup.js"
            }
        ]
    }
}
Name Description Required?
options Options for the script. no
script1 The path to the script that should be invoked. 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. yes

1 supports placeholders

Shell commands

Runs a shell command.

{
    "ego.power-tools": {
        "startup": [
            {
                "type": "shell",
                "command": "git fetch"
            }
        ]
    }
}
Name Description Required?
command1 The command that should be run. no
cwd1 The working directory. Relative paths will be mapped to the workspace root folder. Default: (workspace root folder) no
silent Do not write result to output. Default: (true) no
wait Wait until command has been executed or not. Default: (true) no

1 supports placeholders

⚠️ **GitHub.com Fallback** ⚠️