private provideDebugConfigurationsAsync()

in src/configurationProvider.ts [94:145]


    private provideDebugConfigurationsAsync(folder: vscode.WorkspaceFolder | undefined, token?: vscode.CancellationToken) {
        return new Promise(async (resolve, _reject) => {
            const progressReporter = progressProvider.createProgressReporter("Create launch.json", vscode.ProgressLocation.Window);
            progressReporter.observe(token);
            const defaultLaunchConfig = {
                type: "java",
                name: "Launch Current File",
                request: "launch",
                // tslint:disable-next-line
                mainClass: "${file}",
            };
            try {
                const isOnStandardMode = await utility.waitForStandardMode(progressReporter);
                if (!isOnStandardMode) {
                    resolve([defaultLaunchConfig]);
                    return;
                }

                if (progressReporter.isCancelled()) {
                    resolve([defaultLaunchConfig]);
                    return;
                }
                progressReporter.report("Generating Java configuration...");
                const mainClasses = await lsPlugin.resolveMainClass(folder ? folder.uri : undefined);
                const cache = {};
                const launchConfigs = mainClasses.map((item) => {
                    return {
                        ...defaultLaunchConfig,
                        name: this.constructLaunchConfigName(item.mainClass, cache),
                        mainClass: item.mainClass,
                        projectName: item.projectName,
                    };
                });
                if (progressReporter.isCancelled()) {
                    resolve([defaultLaunchConfig]);
                    return;
                }
                resolve([defaultLaunchConfig, ...launchConfigs]);
            } catch (ex) {
                if (ex instanceof utility.JavaExtensionNotEnabledError) {
                    utility.guideToInstallJavaExtension();
                } else {
                    // tslint:disable-next-line
                    console.error(ex);
                }

                resolve([defaultLaunchConfig]);
            } finally {
                progressReporter.done();
            }
        });
    }