The plugin entry
activate may be async. The editor waits for it before running the command or showing the panel that activated the plugin.
The context
Everything that registers something returns a disposable. Pass it to
context.subscriptions.add(...).
Services
From
@nanoforge-dev/editor-sdk/ui:
Observables
Values that change areObservables: get() reads, subscribe(listener) listens and returns an unsubscribe function. In Svelte, read one as a store with $.
observe calls the listener at once and on every change, and returns a disposable.
Disposables and events
DisposableStore: holds disposables and disposes them together.context.subscriptionsis one.toDisposable(fn): makes a disposable of a function.Emitter<T>: an event source.emitter.event(listener)subscribes and returns a disposable;emitter.fire(value)notifies.
Calling the editor’s server
The server speaks typed contracts. The SDK exports those a plugin may need.RpcErrors with a code (NOT_FOUND, FORBIDDEN, UNAVAILABLE…). A hosted editor refuses with FORBIDDEN what only a local editor can do.
Server entries
A plugin withentry.server runs code in the editor’s server (Bun), for what a browser cannot do. It implements a contract in its own namespace, plugin.<name>, which its client entry then calls.
name, manifest, subscriptions, logger, namespace and implement(contract, implementation). Inputs and outputs are checked against the contract’s schemas.
A server entry runs with the rights of the editor’s server. It starts when the plugin is installed and stops when it is uninstalled. A project plugin’s server entry never runs in a hosted editor.
Dialogs
Mount a Svelte component from a command, and unmount it when it closes. The kit’sDialog handles focus and the overlay.