Skip to main content

configurationAPI

MS Code Extension API


MS Code Extension API / core/extensionAPI/modules/workspace/configurationAPI

core/extensionAPI/modules/workspace/configurationAPI

Functions

createConfigurationAPI()

createConfigurationAPI(extId): object

Defined in: core/extensionAPI/modules/workspace/configurationAPI.ts:11

Factory function to create the Configuration API.

Parameters

extId

string

The unique identifier of the extension.

Returns

getConfiguration

getConfiguration: (section?) => object

Accesses configuration settings for a specific section.

Parameters
section?

string

The configuration section (e.g., 'editor', 'terminal').

Returns

An object containing the get method for the specified section.

get

get: <T>(key, defaultValue?) => T

Retrieves a configuration value.

Type Parameters
T

T = any

The expected type of the configuration value.

Parameters
key

string

The configuration key.

defaultValue?

T

The fallback value if the key is not found.

Returns

T

The value from settings or the provided default.

registerConfiguration

registerConfiguration: (schema) => object

Registers a new configuration schema to the IDE settings UI.

Parameters
schema

IConfigurationSection

The configuration schema defining properties and defaults.

Returns

An object with a dispose method to unregister the settings.

dispose

dispose: () => void

Unregisters the configuration associated with this extension.

Returns

void