Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Executable Settings

Marcel Kloubert edited this page Jan 20, 2019 · 17 revisions

Settings, like [if](Conditional Settings), execute JavaScript code, the time, when they are handled.

The following example, runs an npm install on startup, only if node_modules folder does not exist.

{
    "ego.power-tools": {
        "startup": [
            {
                "command": "npm install",

                "if": " !$fs.existsSync( $v['workspaceRoot'] + '/node_modules' ) "
            }
        ]
    }
}

Keep in mind: Any code needs to be executed synchronously and does NOT support async patterns, like Promises!

Constants

$v

All available values as key/value pair.

!$fs.existsSync( $v['workspaceRoot'] + '/node_modules' )

Functions

$r( moduleId )

Can (also) access any module of that extension.

$r('moment')().format('YYYY-MM-DD') === '1979-09-05'

Modules

Name Description
_ lodash
$fs fs-extra
$h vscode-helpers
$m Moment.js with timezone support
$p Node.js path module
$vs Visual Studio Code API