private async fixMainClass()

in src/configurationProvider.ts [584:639]


    private async fixMainClass(folder: vscode.Uri | undefined, config: vscode.DebugConfiguration,
                               validationResponse: lsPlugin.ILaunchValidationResponse, progressReporter: IProgressReporter):
        Promise<lsPlugin.IMainClassOption | undefined> {
        const errors: string[] = [];
        if (!validationResponse.mainClass.isValid) {
            errors.push(String(validationResponse.mainClass.message));
            const errorLog: Error = {
                name: "error",
                message: this.getValidationErrorMessage(validationResponse.mainClass),
            };
            setUserError(errorLog);
            sendError(errorLog);
        }

        if (!validationResponse.projectName.isValid) {
            errors.push(String(validationResponse.projectName.message));
            const errorLog: Error = {
                name: "error",
                message: this.getValidationErrorMessage(validationResponse.projectName),
            };
            setUserError(errorLog);
            sendError(errorLog);
        }

        if (validationResponse.proposals && validationResponse.proposals.length) {
            progressReporter.hide(true);
            const answer = await utility.showErrorMessageWithTroubleshooting({
                message: errors.join(os.EOL),
                type: Type.USAGEERROR,
                anchor: anchor.FAILED_TO_RESOLVE_CLASSPATH,
                bypassLog: true, // Avoid logging the raw user input in the logger for privacy.
            }, "Fix");
            if (answer === "Fix") {
                const selectedFix = await mainClassPicker.showQuickPick(validationResponse.proposals,
                    "Please select main class<project name>.", false);
                if (selectedFix) {
                    sendInfo("", {
                        fix: "yes",
                        fixMessage: "Fix the configs of mainClass and projectName",
                    });
                    await this.persistMainClassOption(folder, config, selectedFix);
                }

                return selectedFix;
            }
            // return undefined if the user clicks "Learn More".
            return undefined;
        }

        throw new utility.UserError({
            message: errors.join(os.EOL),
            type: Type.USAGEERROR,
            anchor: anchor.FAILED_TO_RESOLVE_CLASSPATH,
            bypassLog: true, // Avoid logging the raw user input in the logger for privacy.
        });
    }