Skip to content

Commit

Permalink
feat: inherit VS Code file icons in SAS Content and Server (#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
scnwwu authored Dec 9, 2024
1 parent 95794c6 commit dcabaa1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
11 changes: 3 additions & 8 deletions client/src/components/ContentNavigator/ContentDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
TabInputText,
TextDocument,
TextDocumentContentProvider,
ThemeIcon,
TreeDataProvider,
TreeDragAndDropController,
TreeItem,
Expand Down Expand Up @@ -230,6 +229,7 @@ class ContentDataProvider
iconPath: this.iconPathForItem(item),
id: item.uid,
label: item.name,
resourceUri: uri,
};
}

Expand Down Expand Up @@ -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) {
Expand All @@ -723,11 +723,6 @@ class ContentDataProvider
icon = "folder";
break;
}
} else {
const extension = item.name.split(".").pop().toLowerCase();
if (extension === "sas") {
icon = "sasProgramFile";
}
}

return icon !== ""
Expand All @@ -738,7 +733,7 @@ class ContentDataProvider
`icons/light/${icon}Light.svg`,
),
}
: ThemeIcon.File;
: undefined;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
DataTransferItem,
FileStat,
FileType,
ThemeIcon,
TreeItem,
Uri,
authentication,
Expand Down Expand Up @@ -175,14 +174,14 @@ 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: {
command: "vscode.open",
arguments: [uri],
title: "Open SAS File",
},
resourceUri: uri,
};

expect(treeItem).to.deep.include(expectedTreeItem);
Expand Down

0 comments on commit dcabaa1

Please sign in to comment.