Skip to content

Commit e3adbb4

Browse files
authored
Update tree item collapsible state (#3559)
1 parent b6c0b0b commit e3adbb4

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/tree/containers/ContainerGroupTreeItem.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { AzExtTreeItem } from "@microsoft/vscode-azext-utils";
7-
import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
7+
import { ThemeIcon, TreeItemCollapsibleState } from "vscode";
88
import { getImageGroupIcon } from "../images/ImageProperties";
99
import { LocalGroupTreeItemBase } from "../LocalGroupTreeItemBase";
1010
import { LocalRootTreeItemBase } from "../LocalRootTreeItemBase";
@@ -13,13 +13,14 @@ import { DockerContainerInfo, NonComposeGroupName } from "./ContainersTreeItem";
1313

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

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

2021
if (this.parent.groupBySetting === 'Compose Project Name') {
2122
// Expand compose group nodes by default
22-
(this as TreeItem).collapsibleState = TreeItemCollapsibleState.Expanded;
23+
this.initialCollapsibleState = TreeItemCollapsibleState.Expanded;
2324
}
2425
}
2526

src/tree/containers/files/DirectoryTreeItem.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ export class DirectoryTreeItem extends AzExtParentTreeItem {
3333
}
3434

3535
public get iconPath(): vscode.ThemeIcon {
36-
return (this as vscode.TreeItem).collapsibleState === vscode.TreeItemCollapsibleState.Expanded
37-
? new vscode.ThemeIcon('folder-opened')
38-
: new vscode.ThemeIcon('folder');
36+
return new vscode.ThemeIcon('folder');
3937
}
4038

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

0 commit comments

Comments
 (0)