From dcabaa1c4d8095cced21439afec61e1c80843fd8 Mon Sep 17 00:00:00 2001 From: Wei Wu <96556502+scnwwu@users.noreply.github.com> Date: Sun, 8 Dec 2024 23:07:29 -0500 Subject: [PATCH] feat: inherit VS Code file icons in SAS Content and Server (#1310) --- .../ContentNavigator/ContentDataProvider.ts | 11 +++-------- .../ContentNavigator/ContentDataProvider.test.ts | 3 +-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/client/src/components/ContentNavigator/ContentDataProvider.ts b/client/src/components/ContentNavigator/ContentDataProvider.ts index f6c1afe97..5cd1d11fb 100644 --- a/client/src/components/ContentNavigator/ContentDataProvider.ts +++ b/client/src/components/ContentNavigator/ContentDataProvider.ts @@ -18,7 +18,6 @@ import { TabInputText, TextDocument, TextDocumentContentProvider, - ThemeIcon, TreeDataProvider, TreeDragAndDropController, TreeItem, @@ -230,6 +229,7 @@ class ContentDataProvider iconPath: this.iconPathForItem(item), id: item.uid, label: item.name, + resourceUri: uri, }; } @@ -698,7 +698,7 @@ class ContentDataProvider private iconPathForItem( item: ContentItem, - ): ThemeIcon | { light: Uri; dark: Uri } { + ): undefined | { light: Uri; dark: Uri } { const isContainer = getIsContainer(item); let icon = ""; if (isContainer) { @@ -723,11 +723,6 @@ class ContentDataProvider icon = "folder"; break; } - } else { - const extension = item.name.split(".").pop().toLowerCase(); - if (extension === "sas") { - icon = "sasProgramFile"; - } } return icon !== "" @@ -738,7 +733,7 @@ class ContentDataProvider `icons/light/${icon}Light.svg`, ), } - : ThemeIcon.File; + : undefined; } } diff --git a/client/test/components/ContentNavigator/ContentDataProvider.test.ts b/client/test/components/ContentNavigator/ContentDataProvider.test.ts index 4caa8fc65..879eece50 100644 --- a/client/test/components/ContentNavigator/ContentDataProvider.test.ts +++ b/client/test/components/ContentNavigator/ContentDataProvider.test.ts @@ -3,7 +3,6 @@ import { DataTransferItem, FileStat, FileType, - ThemeIcon, TreeItem, Uri, authentication, @@ -175,7 +174,6 @@ describe("ContentDataProvider", async function () { const treeItem = await dataProvider.getTreeItem(contentItem); const uri = contentItem.vscUri; const expectedTreeItem: TreeItem = { - iconPath: ThemeIcon.File, id: "unique-id", label: "testFile", command: { @@ -183,6 +181,7 @@ describe("ContentDataProvider", async function () { arguments: [uri], title: "Open SAS File", }, + resourceUri: uri, }; expect(treeItem).to.deep.include(expectedTreeItem);