From e3adbb4abe3e91045be45b977f25cc147e498857 Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Tue, 28 Jun 2022 13:29:41 -0400 Subject: [PATCH] Update tree item collapsible state (#3559) --- src/tree/containers/ContainerGroupTreeItem.ts | 5 +++-- src/tree/containers/files/DirectoryTreeItem.ts | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/tree/containers/ContainerGroupTreeItem.ts b/src/tree/containers/ContainerGroupTreeItem.ts index 4f1317f2f0..120a2002c2 100644 --- a/src/tree/containers/ContainerGroupTreeItem.ts +++ b/src/tree/containers/ContainerGroupTreeItem.ts @@ -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"; @@ -13,13 +13,14 @@ import { DockerContainerInfo, NonComposeGroupName } from "./ContainersTreeItem"; export class ContainerGroupTreeItem extends LocalGroupTreeItemBase { 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, 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; } } diff --git a/src/tree/containers/files/DirectoryTreeItem.ts b/src/tree/containers/files/DirectoryTreeItem.ts index 9cb77603e1..3b790436e3 100644 --- a/src/tree/containers/files/DirectoryTreeItem.ts +++ b/src/tree/containers/files/DirectoryTreeItem.ts @@ -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 {