Skip to content

Commit

Permalink
Update tree item collapsible state (#3559)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft authored Jun 28, 2022
1 parent b6c0b0b commit e3adbb4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/tree/containers/ContainerGroupTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { AzExtTreeItem } from "@microsoft/vscode-azext-utils";
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
import { ThemeIcon, TreeItemCollapsibleState } from "vscode";
import { getImageGroupIcon } from "../images/ImageProperties";
import { LocalGroupTreeItemBase } from "../LocalGroupTreeItemBase";
import { LocalRootTreeItemBase } from "../LocalRootTreeItemBase";
Expand All @@ -13,13 +13,14 @@ import { DockerContainerInfo, NonComposeGroupName } from "./ContainersTreeItem";

export class ContainerGroupTreeItem extends LocalGroupTreeItemBase<DockerContainerInfo, ContainerProperty> {
public childTypeLabel: string = 'container';
public override readonly initialCollapsibleState: TreeItemCollapsibleState | undefined; // TypeScript gets mad if we don't re-declare this here

public constructor(parent: LocalRootTreeItemBase<DockerContainerInfo, ContainerProperty>, group: string, items: DockerContainerInfo[]) {
super(parent, group, items);

if (this.parent.groupBySetting === 'Compose Project Name') {
// Expand compose group nodes by default
(this as TreeItem).collapsibleState = TreeItemCollapsibleState.Expanded;
this.initialCollapsibleState = TreeItemCollapsibleState.Expanded;
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/tree/containers/files/DirectoryTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ export class DirectoryTreeItem extends AzExtParentTreeItem {
}

public get iconPath(): vscode.ThemeIcon {
return (this as vscode.TreeItem).collapsibleState === vscode.TreeItemCollapsibleState.Expanded
? new vscode.ThemeIcon('folder-opened')
: new vscode.ThemeIcon('folder');
return new vscode.ThemeIcon('folder');
}

public async loadMoreChildrenImpl(clearCache: boolean, context: IActionContext): Promise<AzExtTreeItem[]> {
Expand Down

0 comments on commit e3adbb4

Please sign in to comment.