async function initializeExtension()

in src/extension.ts [23:50]


async function initializeExtension(_operationId: string, context: vscode.ExtensionContext): Promise<void> {
    await loadPackageInfo(context);

    context.subscriptions.push(
        instrumentAndRegisterCommand("spring.initializr.maven-project", async (operationId, defaults) => await new GenerateProjectHandler("maven-project", defaults).run(operationId), true),
        instrumentAndRegisterCommand("spring.initializr.gradle-project", async (operationId, defaults) => await new GenerateProjectHandler("gradle-project", defaults).run(operationId), true),
    );

    context.subscriptions.push(instrumentAndRegisterCommand("spring.initializr.createProject", async () => {
        const projectType: { value: string, label: string } = await vscode.window.showQuickPick([
            { value: "maven-project", label: "Maven Project" },
            { value: "gradle-project", label: "Gradle Project" }
        ], { placeHolder: "Select project type." });
        if (projectType) {
            await vscode.commands.executeCommand(`spring.initializr.${projectType.value}`);
        }
    }));

    context.subscriptions.push(instrumentAndRegisterCommand("spring.initializr.addStarters", async (_oid: string, entry?: vscode.Uri) => {
        const targetFile: vscode.Uri = entry || await getTargetPomXml();
        if (targetFile) {
            await vscode.window.showTextDocument(targetFile);
            await new AddStartersHandler().run(_oid, targetFile);
        } else {
            vscode.window.showInformationMessage("No pom.xml found in the workspace.");
        }
    }, true));
}