Skip to content

Commit

Permalink
implement regeneration using the commands
Browse files Browse the repository at this point in the history
  • Loading branch information
thewahome committed Nov 5, 2024
1 parent 242a52b commit 1151a7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from "vscode";
import { ExtensionContext } from "vscode";

import { extensionId, treeViewId } from "../../constants";
import { extensionId, KIOTA_WORKSPACE_FILE, treeViewId } from "../../constants";
import { getGenerationConfiguration, setGenerationConfiguration } from "../../handlers/configurationHandler";
import { OpenApiTreeProvider } from "../../providers/openApiTreeProvider";
import { getExtensionSettings } from "../../types/extensionSettings";
Expand Down Expand Up @@ -57,6 +57,11 @@ export class RegenerateButtonCommand extends Command {

if (isClientType(generationType)) {
await regenerateService.regenerateClient(settings, selectedPaths);

const workspaceJson = vscode.workspace.textDocuments.find(doc => doc.fileName.endsWith(KIOTA_WORKSPACE_FILE));
if (workspaceJson && !workspaceJson.isDirty) {
await regenerateService.regenerateTeamsApp(workspaceJson, clientOrPluginKey);
}
}
if (isPluginType(generationType)) {
await regenerateService.regeneratePlugin(settings, selectedPaths);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ export class RegenerateCommand extends Command {
const regenerateService = new RegenerateService(this._context, this._openApiTreeProvider, clientOrPluginKey, clientOrPluginObject);
if (isClientType(generationType)) {
await regenerateService.regenerateClient(settings);
if (workspaceJson) {
await regenerateService.regenerateTeamsApp(workspaceJson, clientOrPluginKey);
}
}
if (isPluginType(generationType)) {
await regenerateService.regeneratePlugin(settings);
}
}

}

0 comments on commit 1151a7f

Please sign in to comment.