WorkspaceConfiguration

Represents the configuration. It is a merged view of

  • Default Settings

  • Global (User) Settings

  • Workspace settings

  • Workspace Folder settings - From one of the Workspace Folders under which requested resource belongs to.

  • Language settings - Settings defined under requested language.

The effective value (returned by {@linkcode WorkspaceConfiguration.get get}) is computed by overriding or merging the values in the following order:

  1. defaultValue (if defined in package.json otherwise derived from the value's type)

  2. globalValue (if defined)

  3. workspaceValue (if defined)

  4. workspaceFolderValue (if defined)

  5. defaultLanguageValue (if defined)

  6. globalLanguageValue (if defined)

  7. workspaceLanguageValue (if defined)

  8. workspaceFolderLanguageValue (if defined)

Note: Only object value types are merged and all other value types are overridden.

Example 1: Overriding

defaultValue = 'on';
globalValue = 'relative'
workspaceFolderValue = 'off'
value = 'off'

Example 2: Language Values

defaultValue = 'on';
globalValue = 'relative'
workspaceFolderValue = 'off'
globalLanguageValue = 'on'
value = 'on'

Example 3: Object Values

defaultValue = { "a": 1, "b": 2 };
globalValue = { "b": 3, "c": 4 };
value = { "a": 1, "b": 3, "c": 4 };

Note: Workspace and Workspace Folder configurations contains launch and tasks settings. Their basename will be part of the section identifier. The following snippets shows how to retrieve all configurations from launch.json:

// launch.json configuration
const config = workspace.getConfiguration('launch', vscode.workspace.workspaceFolders[0].uri);

// retrieve values
const values = config.get('configurations');

Refer to Settings for more information.

Online Documentation

Functions

Link copied to clipboard
abstract fun <T : JsAny?> get(section: String): T?
abstract fun <T : JsAny?> get(section: String, defaultValue: T): T

Return a value from this configuration.

Link copied to clipboard
abstract fun has(section: String): Boolean

Check if this configuration has a certain value.

Link copied to clipboard
abstract fun update(    section: String,     value: JsAny?,     configurationTarget: JsAny? = definedExternally,     overrideInLanguage: Boolean = definedExternally): PromiseLike<Void>

Update a configuration value. The updated configuration values are persisted.