Skip to content

Commit

Permalink
Merge branch 'elinor/add-kiota-workspace' into elinor/fix-regeneratio…
Browse files Browse the repository at this point in the history
…n-issue
  • Loading branch information
ElinorW authored Jun 28, 2024
2 parents 395a42b + 361d3ae commit af0cd0b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion vscode/microsoft-kiota/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ export async function activate(
{
await checkForSuccess(result);
openApiTreeProvider.refreshView();
openApiTreeProvider.setSelectionChanged(false);
await loadLockFile({fsPath: workspaceJsonPath}, openApiTreeProvider, config.pluginName);
await updateTreeViewIcons(treeViewId, false, true);
await exportLogsAndShowErrors(result);
Expand Down Expand Up @@ -347,6 +348,7 @@ export async function activate(
{
await checkForSuccess(result);
openApiTreeProvider.refreshView();
openApiTreeProvider.setSelectionChanged(false);
await loadLockFile({fsPath: workspaceJsonPath}, openApiTreeProvider, config.pluginName);
await updateTreeViewIcons(treeViewId, false, true);
await exportLogsAndShowErrors(result);
Expand Down Expand Up @@ -418,6 +420,7 @@ export async function activate(
{
await checkForSuccess(result);
openApiTreeProvider.refreshView();
openApiTreeProvider.setSelectionChanged(false);
await loadLockFile({fsPath: workspaceJsonPath}, openApiTreeProvider, config.clientClassName);
await updateTreeViewIcons(treeViewId, false, true);
await exportLogsAndShowErrors(result);
Expand Down Expand Up @@ -455,8 +458,8 @@ export async function activate(
);
return result;
});

void vscode.window.showInformationMessage(`Client ${clientKey} re-generated successfully.`);
openApiTreeProvider.setSelectionChanged(false);
}
async function regeneratePlugin(clientKey: string, clientObject:any, settings: ExtensionSettings, selectedPaths?: string[]) {
const pluginTypes = typeof clientObject.pluginTypes === 'string' ? parsePluginType(clientObject.pluginTypes) : KiotaPluginType.ApiPlugin;
Expand Down Expand Up @@ -490,6 +493,7 @@ export async function activate(
return result;
});
void vscode.window.showInformationMessage(`Plugin ${clientKey} re-generated successfully.`);
openApiTreeProvider.setSelectionChanged(false);
}

// create a new status bar item that we can now manage
Expand Down
8 changes: 4 additions & 4 deletions vscode/microsoft-kiota/src/openApiTreeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider<OpenApiTreeN
public hasSelectionChanged(): boolean {
return this.selectionChanged;
}
public setSelectionChanged() {
this.selectionChanged = true;
public setSelectionChanged(state: boolean) {
this.selectionChanged = state;
}
public async setDescriptionUrl(descriptionUrl: string): Promise<void> {
this.closeDescription(false);
Expand All @@ -196,7 +196,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider<OpenApiTreeN
}
private selectInternal(apiNode: KiotaOpenApiNode, selected: boolean, recursive: boolean) {
apiNode.selected = selected;
this.setSelectionChanged();
this.setSelectionChanged(true);
const isOperationNode = apiNode.isOperation ?? false;
if (recursive) {
apiNode.children.forEach(x => this.selectInternal(x, selected, recursive));
Expand All @@ -206,7 +206,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider<OpenApiTreeN
const parent = this.findApiNode(getPathSegments(trimOperation(apiNode.path)), this.rawRootNode);
if (parent) {
parent.selected = selected;
this.setSelectionChanged();
this.setSelectionChanged(true);
}
}
}
Expand Down

0 comments on commit af0cd0b

Please sign in to comment.