Skip to content

idleberg/node-vscode-get-config

Repository files navigation

vscode-get-config

npm npm CircleCI David

A simple wrapper for vscode.workspace.getConfiguration() provided by the Visual Studio Code API

Features:

  • supports dot notation
  • supports variable substitution

Note: By default, variable substitution is supported only by a handful of settings (see details)

Installation

npm install vscode-get-config -S

Usage

getConfig(section?: string)

Example:

import { getConfig } from 'vscode-get-config';

const { fontFamily, fontSize } = await getConfig('editor');
const fontConfig = await getConfig('editor.fontFamily', 'editor.fontSize');

Variable Substitution

Most of Visual Studio Code's variables will be substituted used in a configuration value

  • all predefined variables

    • ${workspaceFolder}
    • ${workspaceFolderBasename}
    • ${file}
    • ${relativeFile}
    • ${relativeFileDirname}
    • ${fileBasename}
    • ${fileBasenameNoExtension}
    • ${fileDirname}
    • ${fileExtname}
    • ${cwd}
    • ${lineNumber}
    • ${selectedText}
    • ${execPath}
    • ${pathSeparator}
    • ${defaultBuildTask}
  • environment variables, e.g. ${env:USERNAME}

  • configuration variables, e.g. ${config:editor.fontSize}

License

This work is licensed under The MIT License

About

A simple wrapper for `vscode.workspace.getConfiguration()` provided by the Visual Studio Code API

Resources

Stars

Watchers

Forks

Packages

No packages published