@kkdev92/vscode-ext-kit - v4.1.1
    Preparing search index...

    Interface ApplicationHost

    The single owner of an extension's lifecycle.

    There is exactly one asynchronous cleanup path: stop(). The Extension Context owns only a synchronous failsafe that calls beginStop(); framework registrations remain in the Host's own RegistrationScope so an external subscription disposal cannot tear down half of the pipeline independently.

    Do not assume an ordering between the failsafe and deactivate(). Both may request shutdown, and correctness comes from beginStop() and stop() being state-guarded, idempotent and single-flight.

    const host = createApplicationHost({
    name: 'sample',
    start({ registrations }) {
    registrations.own(vscode.commands.registerCommand('sample.run', run));
    },
    });

    export async function activate(context: vscode.ExtensionContext): Promise<void> {
    context.subscriptions.push({ dispose: () => host.beginStop('context-disposed') });
    await host.start();
    }

    export async function deactivate(): Promise<void> {
    await host.stop('deactivate');
    }
    interface ApplicationHost {
        acceptingWork: boolean;
        name: string;
        registrationCount: number;
        resourceCount: number;
        state: HostState;
        beginStop(reason: StopReason): void;
        inspect(): HostInspection;
        start(): Promise<void>;
        stop(reason: StopReason): Promise<void>;
    }
    Index
    acceptingWork: boolean

    Whether new operations may start. True only while running.

    name: string

    Application name.

    registrationCount: number

    Framework-owned registrations still held. Activation-rollback gates read this.

    resourceCount: number

    Framework-owned resources still held.

    state: HostState

    Current lifecycle state.

    • Closes ingress synchronously: disposes registrations and aborts the root signal. Safe to call from a synchronous dispose() — it never throws and never starts async cleanup. The first stop reason wins.

      Parameters

      Returns void

    • Starts the application. Single-flight: concurrent calls share one promise. Rejects with the original activation error after rollback completes. A Host is single-use and cannot start again after stopping or failing.

      Returns Promise<void>

    • Runs the full stop pipeline exactly once. Idempotent: repeated calls share one promise. Never rejects, so deactivate() cannot fail the host; cleanup failures are reported through diagnostics. When the budget expires, it may settle while non-cooperative asynchronous work is still pending.

      Parameters

      Returns Promise<void>