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.
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.
(as-absolute-path extension-context relative-path)
Get the absolute path of a resource contained in the extension.
Note that an absolute uri can be constructed via {@linkcode Uri.joinPath } and
{@linkcode ExtensionContext.extensionUri extensionUri}, e.g. vscode.Uri.joinPath(context.extensionUri, relativePath);
Parameters:
relative-path
: string
- A relative path to a resource contained in the extension.Returns: string
- The absolute path of the resource.
Get the absolute path of a resource contained in the extension. *Note* that an absolute uri can be constructed via {@linkcode Uri.joinPath } and {@linkcode ExtensionContext.extensionUri extensionUri}, e.g. `vscode.Uri.joinPath(context.extensionUri, relativePath);` **Parameters:** - `relative-path`: `string` - A relative path to a resource contained in the extension. **Returns:** `string` - The absolute path of the resource.
(environment-variable-collection extension-context)
Gets the extension's global environment variable collection for this workspace, enabling changes to be applied to terminal environment variables.
Returns: GlobalEnvironmentVariableCollection
Gets the extension's global environment variable collection for this workspace, enabling changes to be applied to terminal environment variables. **Returns:** `GlobalEnvironmentVariableCollection`
(extension extension-context)
The current Extension
instance.
Returns: Extension<any>
The current `Extension` instance. **Returns:** `Extension<any>`
(extension-mode extension-context)
The mode the extension is running in. See {@link ExtensionMode } for possible values and scenarios.
Returns: ExtensionMode
The mode the extension is running in. See {@link ExtensionMode } for possible values and scenarios. **Returns:** `ExtensionMode`
(extension-path extension-context)
The absolute file path of the directory containing the extension. Shorthand notation for {@link TextDocument.uri ExtensionContext.extensionUri.fsPath} (independent of the uri scheme).
Returns: string
The absolute file path of the directory containing the extension. Shorthand notation for {@link TextDocument.uri ExtensionContext.extensionUri.fsPath} (independent of the uri scheme). **Returns:** `string`
(extension-uri extension-context)
The uri of the directory containing the extension.
Returns: Uri
The uri of the directory containing the extension. **Returns:** `Uri`
(global-state extension-context)
A memento object that stores state independent of the current opened {@link workspace.workspaceFolders workspace}.
Returns: Memento & { setKeysForSync(keys: readonly string[]): void; }
A memento object that stores state independent of the current opened {@link workspace.workspaceFolders workspace}. **Returns:** `Memento & { setKeysForSync(keys: readonly string[]): void; }`
(global-storage-path extension-context)
An absolute file path 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.
Use {@linkcode ExtensionContext.globalState globalState} to store key value data.
Returns: string
An absolute file path 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. Use {@linkcode ExtensionContext.globalState globalState} to store key value data. **Returns:** `string`
(global-storage-uri extension-context)
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.
Use {@linkcode ExtensionContext.globalState globalState} to store key value data.
Returns: 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. Use {@linkcode ExtensionContext.globalState globalState} to store key value data. **Returns:** `Uri`
(log-path extension-context)
An absolute file path 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.
Returns: string
An absolute file path 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. **Returns:** `string`
(log-uri extension-context)
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.
Returns: 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. **Returns:** `Uri`
(secrets extension-context)
A storage utility for secrets. Secrets are persisted across reloads and are independent of the current opened {@link workspace.workspaceFolders workspace}.
Returns: SecretStorage
A storage utility for secrets. Secrets are persisted across reloads and are independent of the current opened {@link workspace.workspaceFolders workspace}. **Returns:** `SecretStorage`
(storage-path extension-context)
An absolute file path of a workspace specific directory in which the extension can store private state. The directory might not exist on disk and creation is up to the extension. However, the parent directory is guaranteed to be existent.
Use {@linkcode ExtensionContext.workspaceState workspaceState} or {@linkcode ExtensionContext.globalState globalState} to store key value data.
Returns: string | undefined
An absolute file path of a workspace specific directory in which the extension can store private state. The directory might not exist on disk and creation is up to the extension. However, the parent directory is guaranteed to be existent. Use {@linkcode ExtensionContext.workspaceState workspaceState} or {@linkcode ExtensionContext.globalState globalState} to store key value data. **Returns:** `string | undefined`
(storage-uri extension-context)
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.
Use {@linkcode ExtensionContext.workspaceState workspaceState} or {@linkcode ExtensionContext.globalState globalState} to store key value data.
Returns: Uri | undefined
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. Use {@linkcode ExtensionContext.workspaceState workspaceState} or {@linkcode ExtensionContext.globalState globalState} to store key value data. **Returns:** `Uri | undefined`
(subscriptions extension-context)
An array to which disposables can be added. When this extension is deactivated the disposables will be disposed.
Note that asynchronous dispose-functions aren't awaited.
Returns: { dispose(): any; }[]
An array to which disposables can be added. When this extension is deactivated the disposables will be disposed. *Note* that asynchronous dispose-functions aren't awaited. **Returns:** `{ dispose(): any; }[]`
(workspace-state extension-context)
A memento object that stores state in the context of the currently opened {@link workspace.workspaceFolders workspace}.
Returns: Memento
A memento object that stores state in the context of the currently opened {@link workspace.workspaceFolders workspace}. **Returns:** `Memento`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close