public async prompt()

in ui/src/wizard/AzureWizard.ts [70:148]


    public async prompt(): Promise<void> {
        this._context.ui.wizard = this;

        try {
            let step: AzureWizardPromptStep<T> | undefined = this._promptSteps.pop();
            while (step) {
                if (this._context.ui.wizard?.cancellationToken.isCancellationRequested) {
                    throw new UserCancelledError();
                }

                step.reset();

                this._context.telemetry.properties.lastStep = `prompt-${getEffectiveStepId(step)}`;
                this.title = step.effectiveTitle;
                this._stepHideStepCount = step.hideStepCount;

                if (step.shouldPrompt(this._context)) {
                    step.propertiesBeforePrompt = Object.keys(this._context).filter(k => !isNullOrUndefined(this._context[k]));

                    const loadingQuickPick = this._showLoadingPrompt ? createQuickPick(this._context, {
                        loadingPlaceHolder: localize('loading', 'Loading...')
                    }) : undefined;

                    const disposables: vscode.Disposable[] = [];

                    if (loadingQuickPick) {
                        disposables.push(loadingQuickPick?.onDidHide(() => {
                            if (!this._context.ui.isPrompting) {
                                this._cancellationTokenSource.cancel();
                            }
                        }));
                    }

                    disposables.push(this._context.ui.onDidFinishPrompt((result) => {
                        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
                        step!.prompted = true;
                        loadingQuickPick?.show();
                        if (typeof result.value === 'string' && !result.matchesDefault && this.currentStepId && !step?.supportsDuplicateSteps) {
                            this._cachedInputBoxValues[this.currentStepId] = result.value;
                        }
                    }));

                    try {
                        this.currentStepId = getEffectiveStepId(step);
                        loadingQuickPick?.show();
                        await step.prompt(this._context);
                    } catch (err) {
                        const pe: types.IParsedError = parseError(err);
                        if (pe.errorType === 'GoBackError') { // Use `errorType` instead of `instanceof` so that tests can also hit this case
                            step = this.goBack(step);
                            continue;
                        } else {
                            throw err;
                        }
                    } finally {
                        this.currentStepId = undefined;
                        vscode.Disposable.from(...disposables).dispose();
                        loadingQuickPick?.hide();
                    }
                }

                if (step.getSubWizard) {
                    if (this._context.ui.wizard?.cancellationToken.isCancellationRequested) {
                        throw new UserCancelledError();
                    }
                    const subWizard: types.IWizardOptions<T> | void = await step.getSubWizard(this._context);
                    if (subWizard) {
                        this.addSubWizard(step, subWizard);
                    }
                }

                this._finishedPromptSteps.push(step);
                step = this._promptSteps.pop();
            }
        } finally {
            this._context.ui.wizard = undefined;
            this._cancellationTokenSource.dispose();
        }
    }