vscode-get-config

0.4.0 • Public • Published

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

Package Sidebar

Install

npm i vscode-get-config

Weekly Downloads

3

Version

0.4.0

License

MIT

Unpacked Size

43.2 kB

Total Files

9

Last publish

Collaborators

  • idleberg