public async promptUserForParametersIfApplicable()

in src/lambda/wizards/samDeployWizard.ts [306:395]


    public async promptUserForParametersIfApplicable({
        templateUri,
        missingParameters = new Set<string>(),
    }: {
        templateUri: vscode.Uri
        missingParameters?: Set<string>
    }): Promise<ParameterPromptResult> {
        if (missingParameters.size < 1) {
            const prompt = localize(
                'AWS.samcli.deploy.parameters.optionalPrompt.message',
                // prettier-ignore
                'Template "{0}" contains parameters. Do you want to override their default values?',
                templateUri.fsPath
            )
            const quickPick = picker.createQuickPick<vscode.QuickPickItem>({
                options: {
                    ignoreFocusOut: true,
                    title: prompt,
                    step: 2,
                    totalSteps: this.totalSteps + this.additionalSteps,
                },
                buttons: [this.helpButton, vscode.QuickInputButtons.Back],
                items: [{ label: localizedText.yes }, { label: localizedText.no }],
            })
            const response = getSingleResponse(
                await picker.promptUser({
                    picker: quickPick,
                    onDidTriggerButton: (button, resolve, reject) => {
                        if (button === vscode.QuickInputButtons.Back) {
                            resolve(undefined)
                        } else if (button === this.helpButton) {
                            vscode.env.openExternal(vscode.Uri.parse(samDeployDocUrl))
                        }
                    },
                })
            )
            if (response !== localizedText.yes) {
                return ParameterPromptResult.Continue
            }

            await configureParameterOverrides({
                templateUri,
                requiredParameterNames: missingParameters.keys(),
            })

            return ParameterPromptResult.Cancel
        } else {
            const prompt = localize(
                'AWS.samcli.deploy.parameters.mandatoryPrompt.message',
                // prettier-ignore
                'The template {0} contains parameters without default values. In order to deploy, you must provide values for these parameters. Configure them now?',
                templateUri.fsPath
            )
            const responseConfigure = localize(
                'AWS.samcli.deploy.parameters.mandatoryPrompt.responseConfigure',
                'Configure'
            )
            const responseCancel = localizedText.cancel

            // no step number needed since this is a dead end?
            const quickPick = picker.createQuickPick<vscode.QuickPickItem>({
                options: {
                    ignoreFocusOut: true,
                    title: prompt,
                },
                buttons: [this.helpButton, vscode.QuickInputButtons.Back],
                items: [{ label: responseConfigure }, { label: responseCancel }],
            })
            const response = getSingleResponse(
                await picker.promptUser({
                    picker: quickPick,
                    onDidTriggerButton: (button, resolve, reject) => {
                        if (button === vscode.QuickInputButtons.Back) {
                            resolve(undefined)
                        } else if (button === this.helpButton) {
                            vscode.env.openExternal(vscode.Uri.parse(samDeployDocUrl))
                        }
                    },
                })
            )
            if (response === responseConfigure) {
                await configureParameterOverrides({
                    templateUri,
                    requiredParameterNames: missingParameters.keys(),
                })
            }

            return ParameterPromptResult.Cancel
        }
    }