WorkspaceConfiguration class

Represents the configuration. It is a merged view of

  • Default Settings
  • Global (User) Settings
  • Workspace settings
  • Workspace Folder settings - From one of the {@link workspace.workspaceFoldersWorkspace Folders} under which requested resource belongs to.
  • Language settings - Settings defined under requested language.

The effective value (returned by {@linkcode WorkspaceConfiguration.getget}) 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.

Available extensions
Annotations
  • @JS()
  • @staticInterop
  • @anonymous

Constructors

WorkspaceConfiguration({bool has(String)?, dynamic inspect<T>(String)?, Future update(String, [dynamic, dynamic, bool?])?})
factory

Properties

has bool Function(String)

Available on WorkspaceConfiguration, provided by the WorkspaceConfiguration$Typings extension

getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
inspect ↔ dynamic Function<T>(String)

Available on WorkspaceConfiguration, provided by the WorkspaceConfiguration$Typings extension

getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
update Future Function(String, [dynamic, dynamic, bool?])

Available on WorkspaceConfiguration, provided by the WorkspaceConfiguration$Typings extension

getter/setter pair

Methods

get<T>(String section, T defaultValue) → T

Available on WorkspaceConfiguration, provided by the WorkspaceConfiguration$Typings extension

Return a value from this configuration.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String index) → dynamic

Available on WorkspaceConfiguration, provided by the WorkspaceConfiguration$Typings extension