Skip to content

Commit

Permalink
- fixes collapsed state not being reset between filters
Browse files Browse the repository at this point in the history
  • Loading branch information
baywet committed Jan 30, 2024
1 parent 2b19035 commit 477c254
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vscode/microsoft-kiota/src/openApiTreeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider<OpenApiTreeN
if (!this.rawRootNode) {
return;
}
this.tokenizedFilter = filterText.length === 0 ? [] : filterText.split(' ').filter(x => x !== '').map(x => x.trim().toLowerCase());
this.tokenizedFilter = filterText.length === 0 ? [] : filterText.split(' ').filter(x => x !== '').map(x => x.trim().toLowerCase()).sort();
this.refreshView();
}
public get filter(): string {
Expand Down Expand Up @@ -228,6 +228,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider<OpenApiTreeN
node.selected ?? false,
collapsibleStateOverride ?? this.getCollapsedState(node),
node.isOperation ?? false,
this.tokenizedFilter,
node.children.map(x => this.getTreeNodeFromKiotaNode(x)),
node.documentationUrl
);
Expand Down Expand Up @@ -263,10 +264,12 @@ export class OpenApiTreeNode extends vscode.TreeItem {
selected: boolean,
public readonly collapsibleState: vscode.TreeItemCollapsibleState,
private readonly isOperation: boolean,
filterTokens: string[],
public readonly children: OpenApiTreeNode[] = [],
public readonly documentationUrl?: string,
) {
super(label, collapsibleState);
this.id = `${path}_${filterTokens.join('_')}`; // so the collapsed state is NOT persisted between filter changes
this.contextValue = documentationUrl;
this.iconPath = selected ? OpenApiTreeNode.selectedSet : OpenApiTreeNode.unselectedSet;
}
Expand Down

0 comments on commit 477c254

Please sign in to comment.