ExtensionContext

An extension context is a collection of utilities private to an extension.

An instance of an ExtensionContext is provided as the first parameter to the activate-call of an extension.

Online Documentation

Properties

Link copied to clipboard

Gets the extension's global environment variable collection for this workspace, enabling changes to be applied to terminal environment variables.

Link copied to clipboard
abstract val extension: Extension<*>

The current Extension instance.

Link copied to clipboard

The mode the extension is running in. See ExtensionMode for possible values and scenarios.

Link copied to clipboard
abstract val extensionPath: String

The absolute file path of the directory containing the extension. Shorthand notation for ExtensionContext.extensionUri.fsPath (independent of the uri scheme).

Link copied to clipboard
abstract val extensionUri: Uri

The uri of the directory containing the extension.

Link copied to clipboard
abstract val globalStorageUri: Uri

The uri of a directory in which the extension can store global state. The directory might not exist on disk and creation is up to the extension. However, the parent directory is guaranteed to be existent.

Link copied to clipboard

An object that keeps information about how this extension can use language models.

Link copied to clipboard
abstract val logUri: Uri

The uri of a directory in which the extension can create log files. The directory might not exist on disk and creation is up to the extension. However, the parent directory is guaranteed to be existent.

Link copied to clipboard
abstract val secrets: SecretStorage

A secret storage object that stores state independent of the current opened workspace.

Link copied to clipboard
abstract val storageUri: Uri?

The uri of a workspace specific directory in which the extension can store private state. The directory might not exist and creation is up to the extension. However, the parent directory is guaranteed to be existent. The value is undefined when no workspace nor folder has been opened.

Link copied to clipboard

An array to which disposables can be added. When this extension is deactivated the disposables will be disposed.

Link copied to clipboard
abstract val workspaceState: Memento

A memento object that stores state in the context of the currently opened workspace.

Functions

Link copied to clipboard
abstract fun asAbsolutePath(relativePath: String): String

Get the absolute path of a resource contained in the extension.