Skip to content

Commit c97a496

Browse files
Add section about custom activation events to custom plugin API docu (#13190)
Relates to #13067
1 parent 2527596 commit c97a496

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/plugin-ext/doc/how-to-add-new-custom-plugin-api.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,16 @@ import * as foo from '@bar/foo';
260260
foo.fooBar.getFoo();
261261
```
262262

263+
## Adding custom plugin activation events
264+
265+
When creating a custom plugin API there may also arise a need to trigger the activation of your plugins at a certain point in time.
266+
The events that trigger the activation of a plugin are simply called `activation events`.
267+
By default Theia supports a set of built-in activation events that contains the [activation events from VS Code](https://code.visualstudio.com/api/references/activation-events) as well as some additional Theia-specific events.
268+
Technically, an activation event is nothing more than a unique string fired at a specific point in time.
269+
To add more flexibility to activations events, Theia allows you to provide additional custom activation events when initializing a plugin host.
270+
These additional events can be specified by adopters through the `ADDITIONAL_ACTIVATION_EVENTS` environment variable.
271+
To fire an activation event, you need to call the plugin hosts `$activateByEvent(eventName)` method.
272+
263273
## Packaging
264274

265275
When bundling our application with the generated `gen-webpack.node.config.js` we need to make sure that our initialization function is bundled as a `commonjs2` library so it can be dynamically loaded.

0 commit comments

Comments
 (0)