From 4106832510caab108c28022e4c7773d89cb7a4b4 Mon Sep 17 00:00:00 2001
From: aswinkumar863 <32381261+aswinkumar863@users.noreply.github.com>
Date: Tue, 20 Jun 2023 00:05:13 +0530
Subject: [PATCH] feat: switch to codicons (#1553)
---
icons/dark/add.svg | 1 -
icons/dark/changelist.svg | 7 --
icons/dark/check.svg | 1 -
icons/dark/clean.svg | 1 -
icons/dark/download.svg | 4 --
icons/dark/folder.svg | 4 --
icons/dark/icon-commit.svg | 4 --
icons/dark/icon-history.svg | 4 --
icons/dark/icon-repo.svg | 4 --
icons/dark/icon-unfold.svg | 4 --
icons/dark/open-file.svg | 1 -
icons/dark/refresh.svg | 1 -
icons/dark/remove.svg | 1 -
icons/dark/repo.svg | 4 --
icons/light/add.svg | 1 -
icons/light/changelist.svg | 7 --
icons/light/check.svg | 1 -
icons/light/clean.svg | 1 -
icons/light/download.svg | 4 --
icons/light/folder.svg | 4 --
icons/light/icon-commit.svg | 4 --
icons/light/icon-history.svg | 4 --
icons/light/icon-repo.svg | 4 --
icons/light/icon-unfold.svg | 4 --
icons/light/open-file.svg | 3 -
icons/light/refresh.svg | 1 -
icons/light/remove.svg | 1 -
icons/light/repo.svg | 4 --
package.json | 100 ++++++-----------------------
src/historyView/common.ts | 5 +-
src/historyView/itemLogProvider.ts | 6 +-
src/historyView/repoLogProvider.ts | 7 +-
32 files changed, 30 insertions(+), 172 deletions(-)
delete mode 100644 icons/dark/add.svg
delete mode 100644 icons/dark/changelist.svg
delete mode 100644 icons/dark/check.svg
delete mode 100644 icons/dark/clean.svg
delete mode 100644 icons/dark/download.svg
delete mode 100644 icons/dark/folder.svg
delete mode 100644 icons/dark/icon-commit.svg
delete mode 100644 icons/dark/icon-history.svg
delete mode 100644 icons/dark/icon-repo.svg
delete mode 100644 icons/dark/icon-unfold.svg
delete mode 100644 icons/dark/open-file.svg
delete mode 100644 icons/dark/refresh.svg
delete mode 100644 icons/dark/remove.svg
delete mode 100644 icons/dark/repo.svg
delete mode 100644 icons/light/add.svg
delete mode 100644 icons/light/changelist.svg
delete mode 100644 icons/light/check.svg
delete mode 100644 icons/light/clean.svg
delete mode 100644 icons/light/download.svg
delete mode 100644 icons/light/folder.svg
delete mode 100644 icons/light/icon-commit.svg
delete mode 100644 icons/light/icon-history.svg
delete mode 100644 icons/light/icon-repo.svg
delete mode 100644 icons/light/icon-unfold.svg
delete mode 100644 icons/light/open-file.svg
delete mode 100644 icons/light/refresh.svg
delete mode 100644 icons/light/remove.svg
delete mode 100644 icons/light/repo.svg
diff --git a/icons/dark/add.svg b/icons/dark/add.svg
deleted file mode 100644
index 3475c1e1..00000000
--- a/icons/dark/add.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/icons/dark/changelist.svg b/icons/dark/changelist.svg
deleted file mode 100644
index 7e568db2..00000000
--- a/icons/dark/changelist.svg
+++ /dev/null
@@ -1,7 +0,0 @@
-
diff --git a/icons/dark/check.svg b/icons/dark/check.svg
deleted file mode 100644
index c225b2f5..00000000
--- a/icons/dark/check.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/icons/dark/clean.svg b/icons/dark/clean.svg
deleted file mode 100644
index 9f175633..00000000
--- a/icons/dark/clean.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/icons/dark/download.svg b/icons/dark/download.svg
deleted file mode 100644
index 12ad689a..00000000
--- a/icons/dark/download.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/icons/dark/folder.svg b/icons/dark/folder.svg
deleted file mode 100644
index 09100fdd..00000000
--- a/icons/dark/folder.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/icons/dark/icon-commit.svg b/icons/dark/icon-commit.svg
deleted file mode 100644
index ecd69492..00000000
--- a/icons/dark/icon-commit.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/icons/dark/icon-history.svg b/icons/dark/icon-history.svg
deleted file mode 100644
index 54b78086..00000000
--- a/icons/dark/icon-history.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
diff --git a/icons/dark/icon-repo.svg b/icons/dark/icon-repo.svg
deleted file mode 100644
index b1f87469..00000000
--- a/icons/dark/icon-repo.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/icons/dark/icon-unfold.svg b/icons/dark/icon-unfold.svg
deleted file mode 100644
index a7b1d662..00000000
--- a/icons/dark/icon-unfold.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/icons/dark/open-file.svg b/icons/dark/open-file.svg
deleted file mode 100644
index f6302185..00000000
--- a/icons/dark/open-file.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/icons/dark/refresh.svg b/icons/dark/refresh.svg
deleted file mode 100644
index d79fdaa4..00000000
--- a/icons/dark/refresh.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/icons/dark/remove.svg b/icons/dark/remove.svg
deleted file mode 100644
index 2de46fcf..00000000
--- a/icons/dark/remove.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/icons/dark/repo.svg b/icons/dark/repo.svg
deleted file mode 100644
index b1f87469..00000000
--- a/icons/dark/repo.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/icons/light/add.svg b/icons/light/add.svg
deleted file mode 100644
index bdecdb0e..00000000
--- a/icons/light/add.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/icons/light/changelist.svg b/icons/light/changelist.svg
deleted file mode 100644
index 4232b851..00000000
--- a/icons/light/changelist.svg
+++ /dev/null
@@ -1,7 +0,0 @@
-
diff --git a/icons/light/check.svg b/icons/light/check.svg
deleted file mode 100644
index d45df06e..00000000
--- a/icons/light/check.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/icons/light/clean.svg b/icons/light/clean.svg
deleted file mode 100644
index 1fa6ba48..00000000
--- a/icons/light/clean.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/icons/light/download.svg b/icons/light/download.svg
deleted file mode 100644
index f271a008..00000000
--- a/icons/light/download.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/icons/light/folder.svg b/icons/light/folder.svg
deleted file mode 100644
index ccd1c74e..00000000
--- a/icons/light/folder.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/icons/light/icon-commit.svg b/icons/light/icon-commit.svg
deleted file mode 100644
index 82bf1740..00000000
--- a/icons/light/icon-commit.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/icons/light/icon-history.svg b/icons/light/icon-history.svg
deleted file mode 100644
index 11bf4d3e..00000000
--- a/icons/light/icon-history.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
diff --git a/icons/light/icon-repo.svg b/icons/light/icon-repo.svg
deleted file mode 100644
index 4e2368ef..00000000
--- a/icons/light/icon-repo.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/icons/light/icon-unfold.svg b/icons/light/icon-unfold.svg
deleted file mode 100644
index 963d56d1..00000000
--- a/icons/light/icon-unfold.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/icons/light/open-file.svg b/icons/light/open-file.svg
deleted file mode 100644
index fccdf83d..00000000
--- a/icons/light/open-file.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-]>
\ No newline at end of file
diff --git a/icons/light/refresh.svg b/icons/light/refresh.svg
deleted file mode 100644
index e0345748..00000000
--- a/icons/light/refresh.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/icons/light/remove.svg b/icons/light/remove.svg
deleted file mode 100644
index f5d128b2..00000000
--- a/icons/light/remove.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/icons/light/repo.svg b/icons/light/repo.svg
deleted file mode 100644
index 4e2368ef..00000000
--- a/icons/light/repo.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/package.json b/package.json
index 85eb842f..e027686e 100644
--- a/package.json
+++ b/package.json
@@ -136,10 +136,7 @@
"command": "svn.add",
"title": "Add",
"category": "SVN",
- "icon": {
- "light": "icons/light/add.svg",
- "dark": "icons/dark/add.svg"
- }
+ "icon": "$(add)"
},
{
"command": "svn.addToIgnoreExplorer",
@@ -160,19 +157,13 @@
"command": "svn.branchchanges.refresh",
"category": "SVN",
"title": "Refresh branch changes",
- "icon": {
- "dark": "icons/dark/refresh.svg",
- "light": "icons/light/refresh.svg"
- }
+ "icon": "$(refresh)"
},
{
"command": "svn.changelist",
"title": "Set changelist",
"category": "SVN",
- "icon": {
- "light": "icons/light/changelist.svg",
- "dark": "icons/dark/changelist.svg"
- }
+ "icon": "$(list-unordered)"
},
{
"command": "svn.checkout",
@@ -193,19 +184,13 @@
"command": "svn.commit",
"title": "Commit Selected",
"category": "SVN",
- "icon": {
- "light": "icons/light/check.svg",
- "dark": "icons/dark/check.svg"
- }
+ "icon": "$(check)"
},
{
"command": "svn.commitWithMessage",
"title": "Commit Changes",
"category": "SVN",
- "icon": {
- "light": "icons/light/check.svg",
- "dark": "icons/dark/check.svg"
- }
+ "icon": "$(check)"
},
{
"command": "svn.deleteUnversioned",
@@ -241,10 +226,7 @@
"command": "svn.itemlog.refresh",
"category": "SVN",
"title": "Refresh log for item",
- "icon": {
- "dark": "icons/dark/refresh.svg",
- "light": "icons/light/refresh.svg"
- }
+ "icon": "$(refresh)"
},
{
"command": "svn.log",
@@ -283,10 +265,7 @@
"command": "svn.openFile",
"title": "Open File",
"category": "SVN",
- "icon": {
- "light": "icons/light/open-file.svg",
- "dark": "icons/dark/open-file.svg"
- }
+ "icon": "$(go-to-file)"
},
{
"command": "svn.openHEADFile",
@@ -312,28 +291,19 @@
"command": "svn.pickCommitMessage",
"title": "Pick a previous commit message",
"category": "SVN",
- "icon": {
- "light": "icons/light/icon-history.svg",
- "dark": "icons/dark/icon-history.svg"
- }
+ "icon": "$(history)"
},
{
"command": "svn.refresh",
"title": "Refresh",
"category": "SVN",
- "icon": {
- "light": "icons/light/refresh.svg",
- "dark": "icons/dark/refresh.svg"
- }
+ "icon": "$(refresh)"
},
{
"command": "svn.refreshRemoteChanges",
"title": "Refresh Remote Changes",
"category": "SVN",
- "icon": {
- "light": "icons/light/refresh.svg",
- "dark": "icons/dark/refresh.svg"
- }
+ "icon": "$(refresh)"
},
{
"command": "svn.remove",
@@ -354,10 +324,7 @@
"command": "svn.repolog.addrepolike",
"category": "SVN",
"title": "Add repo-like path",
- "icon": {
- "dark": "icons/dark/add.svg",
- "light": "icons/light/add.svg"
- }
+ "icon": "$(add)"
},
{
"command": "svn.repolog.copymsg",
@@ -388,10 +355,7 @@
"command": "svn.repolog.refresh",
"category": "SVN",
"title": "Refresh log",
- "icon": {
- "dark": "icons/dark/refresh.svg",
- "light": "icons/light/refresh.svg"
- }
+ "icon": "$(refresh)"
},
{
"command": "svn.repolog.remove",
@@ -402,10 +366,7 @@
"command": "svn.resolve",
"title": "Resolve conflicts for selected",
"category": "SVN",
- "icon": {
- "light": "icons/light/check.svg",
- "dark": "icons/dark/check.svg"
- }
+ "icon": "$(check)"
},
{
"command": "svn.resolveAll",
@@ -416,37 +377,25 @@
"command": "svn.revert",
"title": "Revert Selected File",
"category": "SVN",
- "icon": {
- "light": "icons/light/clean.svg",
- "dark": "icons/dark/clean.svg"
- }
+ "icon": "$(discard)"
},
{
"command": "svn.revertAll",
"title": "Revert All Changes",
"category": "SVN",
- "icon": {
- "light": "icons/light/clean.svg",
- "dark": "icons/dark/clean.svg"
- }
+ "icon": "$(discard)"
},
{
"command": "svn.revertChange",
"title": "Revert Change",
"category": "SVN",
- "icon": {
- "light": "icons/light/clean.svg",
- "dark": "icons/dark/clean.svg"
- }
+ "icon": "$(discard)"
},
{
"command": "svn.revertExplorer",
"title": "Revert with SVN",
"category": "SVN",
- "icon": {
- "light": "icons/light/clean.svg",
- "dark": "icons/dark/clean.svg"
- }
+ "icon": "$(discard)"
},
{
"command": "svn.searchLogByRevision",
@@ -467,28 +416,19 @@
"command": "svn.treeview.pullIncomingChange",
"title": "Update selected",
"category": "SVN",
- "icon": {
- "light": "icons/light/download.svg",
- "dark": "icons/dark/download.svg"
- }
+ "icon": "$(cloud-download)"
},
{
"command": "svn.treeview.refreshProvider",
"title": "Refresh",
"category": "SVN",
- "icon": {
- "light": "icons/light/refresh.svg",
- "dark": "icons/dark/refresh.svg"
- }
+ "icon": "$(refresh)"
},
{
"command": "svn.update",
"title": "Update",
"category": "SVN",
- "icon": {
- "light": "icons/light/download.svg",
- "dark": "icons/dark/download.svg"
- }
+ "icon": "$(cloud-download)"
}
],
"menus": {
diff --git a/src/historyView/common.ts b/src/historyView/common.ts
index 676800e0..c529352e 100644
--- a/src/historyView/common.ts
+++ b/src/historyView/common.ts
@@ -6,6 +6,7 @@ import {
commands,
env,
TextDocumentShowOptions,
+ ThemeIcon,
TreeItem,
Uri,
window
@@ -202,12 +203,12 @@ function md5(s: string): string {
export function getCommitIcon(
author: string,
size: number = 16
-): Uri | { light: Uri; dark: Uri } {
+): Uri | { light: Uri; dark: Uri } | ThemeIcon {
if (
(!configuration.get("gravatars.enabled", true) as boolean) ||
author === undefined
) {
- return getIconObject("icon-commit");
+ return new ThemeIcon("git-commit");
}
let gravatar = gravatarCache.get(author);
diff --git a/src/historyView/itemLogProvider.ts b/src/historyView/itemLogProvider.ts
index d83731c7..6dea04cd 100644
--- a/src/historyView/itemLogProvider.ts
+++ b/src/historyView/itemLogProvider.ts
@@ -5,6 +5,7 @@ import {
Event,
EventEmitter,
TextEditor,
+ ThemeIcon,
TreeDataProvider,
TreeItem,
TreeItemCollapsibleState,
@@ -20,7 +21,6 @@ import {
getCommitIcon,
getCommitLabel,
getCommitToolTip,
- getIconObject,
getLimit,
ICachedLog,
ILogTreeItem,
@@ -178,7 +178,7 @@ export class ItemLogProvider
const ti = new TreeItem(fname, TreeItemCollapsibleState.Expanded);
ti.tooltip = path.dirname(this.currentItem.svnTarget.fsPath);
ti.description = path.dirname(this.currentItem.svnTarget.fsPath);
- ti.iconPath = getIconObject("icon-history");
+ ti.iconPath = new ThemeIcon("history");
const item = {
kind: LogTreeItemKind.TItem,
data: ti
@@ -203,7 +203,7 @@ export class ItemLogProvider
arguments: [element, undefined, true],
title: "refresh element"
};
- ti.iconPath = getIconObject("icon-unfold");
+ ti.iconPath = new ThemeIcon("unfold");
result.push(ltItem);
}
return result;
diff --git a/src/historyView/repoLogProvider.ts b/src/historyView/repoLogProvider.ts
index 5d60cccd..4cd6d164 100644
--- a/src/historyView/repoLogProvider.ts
+++ b/src/historyView/repoLogProvider.ts
@@ -4,6 +4,7 @@ import {
Disposable,
Event,
EventEmitter,
+ ThemeIcon,
TreeDataProvider,
TreeItem,
TreeItemCollapsibleState,
@@ -327,9 +328,9 @@ export class RepoLogProvider
ti.contextValue = "repo";
}
if (cached.repo instanceof Repository) {
- ti.iconPath = getIconObject("folder");
+ ti.iconPath = new ThemeIcon("folder-opened");
} else {
- ti.iconPath = getIconObject("icon-repo");
+ ti.iconPath = new ThemeIcon("repo");
}
const from = cached.persisted.commitFrom || "HEAD";
ti.tooltip = `${svnTarget} since ${from}`;
@@ -400,7 +401,7 @@ export class RepoLogProvider
arguments: [element, true],
title: "refresh element"
};
- ti.iconPath = getIconObject("icon-unfold");
+ ti.iconPath = new ThemeIcon("unfold");
result.push({ kind: LogTreeItemKind.TItem, data: ti });
}
return result;