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

    Interface QuickInputService

    Asking the user for something.

    One service rather than four free functions taking a capability, for the same reason as Localization and Editors: every member needs the same platform surface, and threading it through each call is bookkeeping the caller should not be doing.

    Every interactive call accepts the operation's signal (wizard calls take it at run()), so a control can close when the command is cancelled or the application stops — not only when the user presses Escape.

    module.commands.handle(Sync, {
    inject: { ask: QuickInput },
    execute: async (context, _args, { ask }) => {
    const target = await ask.one(items, { title: 'Sync what?', signal: context.signal });
    if (target === undefined) return false;
    return sync(target.value);
    },
    });
    interface QuickInputService {
        many<T extends QuickPickItemLike>(
            items: readonly T[] | Promise<readonly T[]>,
            options?: PickOptions<T>,
        ): Promise<T[] | undefined>;
        one<T extends QuickPickItemLike>(
            items: readonly T[] | Promise<readonly T[]>,
            options?: PickOptions<T>,
        ): Promise<T | undefined>;
        text(options: InputTextOptions): Promise<string | undefined>;
        wizard(): WizardBuilder<Record<never, never>>;
    }
    Index
    • Shows a quick pick for one choice. Resolves undefined when dismissed.

      items may be a promise, in which case the picker opens immediately with a busy indicator while the list resolves — worth doing when building it means a file scan or an API call.

      Type Parameters

      Parameters

      • items: readonly T[] | Promise<readonly T[]>
      • Optionaloptions: PickOptions<T>

      Returns Promise<T | undefined>

    • Starts a multi-step wizard, with a working Back button between steps.

      Returns WizardBuilder<Record<never, never>>

      const result = await ask
      .wizard()
      .step('name', inputStep({ prompt: 'Project name' }))
      .step('kind', quickpickStep({ items: kinds }))
      .run({ signal: context.signal });