Namespace for dealing with installed extensions. Extensions are represented by an {@link Extension }-interface which enables reflection on them.
Extension writers can provide APIs to other extensions by returning their API public
surface from the activate-call.
export function activate(context: vscode.ExtensionContext) {
let api = {
sum(a, b) {
return a + b;
},
mul(a, b) {
return a * b;
}
};
// 'export' public api-surface
return api;
}
When depending on the API of another extension add an extensionDependencies-entry
to package.json, and use the {@link extensions.getExtension getExtension}-function
and the {@link Extension.exports exports}-property, like below:
let mathExt = extensions.getExtension('genius.math');
let importedApi = mathExt.exports;
console.log(importedApi.mul(42, 1));
Namespace for dealing with installed extensions. Extensions are represented
by an {@link Extension }-interface which enables reflection on them.
Extension writers can provide APIs to other extensions by returning their API public
surface from the `activate`-call.
```javascript
export function activate(context: vscode.ExtensionContext) {
let api = {
sum(a, b) {
return a + b;
},
mul(a, b) {
return a * b;
}
};
// 'export' public api-surface
return api;
}
```
When depending on the API of another extension add an `extensionDependencies`-entry
to `package.json`, and use the {@link extensions.getExtension getExtension}-function
and the {@link Extension.exports exports}-property, like below:
```javascript
let mathExt = extensions.getExtension('genius.math');
let importedApi = mathExt.exports;
console.log(importedApi.mul(42, 1));
```(all)All extensions currently known to the system.
Returns: readonly Extension<any>[]
All extensions currently known to the system. **Returns:** `readonly Extension<any>[]`
(extension extension-id)Get an extension by its full identifier in the form of: publisher.name.
Parameters:
extension-id: string - An extension identifier.Returns: Extension<T> | undefined - An extension or undefined.
Get an extension by its full identifier in the form of: `publisher.name`. **Parameters:** - `extension-id`: `string` - An extension identifier. **Returns:** `Extension<T> | undefined` - An extension or `undefined`.
(on-did-change)(on-did-change listener)(on-did-change listener this-args)(on-did-change listener this-args disposables)An event which fires when extensions.all changes. This can happen when extensions are
installed, uninstalled, enabled or disabled.
Parameters:
listener: (e: T) => any - The listener function will be called when the event happens.this-args: any - The this-argument which will be used when calling the event listener.disposables: Disposable[] | undefined - An array to which a {@link Disposable } will be added.Returns: Disposable - A disposable which unsubscribes the event listener.
An event which fires when `extensions.all` changes. This can happen when extensions are
installed, uninstalled, enabled or disabled.
**Parameters:**
- `listener`: `(e: T) => any` - The listener function will be called when the event happens.
- `this-args`: `any` - The `this`-argument which will be used when calling the event listener.
- `disposables`: `Disposable[] | undefined` - An array to which a {@link Disposable } will be added.
**Returns:** `Disposable` - A disposable which unsubscribes the event listener.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |