Skip to content

Commit

Permalink
Mutator grouping fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mullr committed May 12, 2024
1 parent c9458fc commit 154014a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions vscode/src/mutators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,16 @@ export class MutatorsTreeDataProvider implements vscode.TreeDataProvider<Mutator
vscode.commands.registerCommand("auxon.mutators.createMutation", (itemData) => {
this.createMutation(itemData);
}),
this.wss.onDidChangeActiveWorkspace(() => this.refresh()),
this.wss.onDidChangeUsedSegments(() => this.refresh())
);

this.refresh();
}

refresh(): void {
this.workspaceMutatorGroupingAttrs = this.wss.mutatorGroupingAttrs;

vscode.commands.executeCommand(
"setContext",
"auxon.mutators.unavailable",
Expand Down
10 changes: 8 additions & 2 deletions vscode/src/workspaceState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export class WorkspaceAndSegmentState {
public activeWorkspaceName: string,
public activeWorkspaceVersionId: string,
public usedSegmentConfig: cliConfig.ContextSegment,
public activeSegments: ActiveSegments
public activeSegments: ActiveSegments,
public mutatorGroupingAttrs: string[],
) {}

static async create(apiClient: api.Client): Promise<WorkspaceAndSegmentState> {
Expand Down Expand Up @@ -96,6 +97,7 @@ export class WorkspaceAndSegmentState {
}
}
}

if (resetToLatestWorkspace) {
vscode.window.showWarningMessage(`Active segment is for a different workspace; reverting to latest.`);
await _useLatestSegment();
Expand All @@ -106,12 +108,16 @@ export class WorkspaceAndSegmentState {
};
}

let ws_def = await apiClient.workspace(activeWorkspaceVersionId).definition();
let mutatorGroupingAttrs = ws_def.mutator_grouping_attrs;

return new WorkspaceAndSegmentState(
apiClient,
activeWorkspaceName,
activeWorkspaceVersionId,
usedSegmentConfig,
activeSegments
activeSegments,
mutatorGroupingAttrs
);
}

Expand Down

0 comments on commit 154014a

Please sign in to comment.