Skip to content

Commit 0771e93

Browse files
committed
Use vscode icons
1 parent 64e73c6 commit 0771e93

File tree

4 files changed

+7
-211
lines changed

4 files changed

+7
-211
lines changed

extensions/ql-vscode/media/dark/check.svg

Lines changed: 0 additions & 56 deletions
This file was deleted.

extensions/ql-vscode/media/light/check.svg

Lines changed: 0 additions & 57 deletions
This file was deleted.

extensions/ql-vscode/media/red-x.svg

Lines changed: 0 additions & 58 deletions
This file was deleted.

extensions/ql-vscode/src/databases-ui.ts

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
window,
1111
env,
1212
CancellationToken,
13+
ThemeIcon,
14+
ThemeColor,
1315
} from "vscode";
1416
import { pathExists, stat, readdir, remove } from "fs-extra";
1517

@@ -39,33 +41,6 @@ import { Credentials } from "./authentication";
3941
import { QueryRunner } from "./queryRunner";
4042
import { isCanary } from "./config";
4143

42-
type ThemableIconPath = { light: string; dark: string } | string;
43-
44-
/**
45-
* Path to icons to display next to currently selected database.
46-
*/
47-
const SELECTED_DATABASE_ICON: ThemableIconPath = {
48-
light: "media/light/check.svg",
49-
dark: "media/dark/check.svg",
50-
};
51-
52-
/**
53-
* Path to icon to display next to an invalid database.
54-
*/
55-
const INVALID_DATABASE_ICON: ThemableIconPath = "media/red-x.svg";
56-
57-
function joinThemableIconPath(
58-
base: string,
59-
iconPath: ThemableIconPath,
60-
): ThemableIconPath {
61-
if (typeof iconPath == "object")
62-
return {
63-
light: join(base, iconPath.light),
64-
dark: join(base, iconPath.dark),
65-
};
66-
else return join(base, iconPath);
67-
}
68-
6944
enum SortOrder {
7045
NameAsc = "NameAsc",
7146
NameDesc = "NameDesc",
@@ -87,10 +62,7 @@ class DatabaseTreeDataProvider
8762
);
8863
private currentDatabaseItem: DatabaseItem | undefined;
8964

90-
constructor(
91-
private databaseManager: DatabaseManager,
92-
private readonly extensionPath: string,
93-
) {
65+
constructor(private databaseManager: DatabaseManager) {
9466
super();
9567

9668
this.currentDatabaseItem = databaseManager.currentDatabaseItem;
@@ -135,16 +107,11 @@ class DatabaseTreeDataProvider
135107
public getTreeItem(element: DatabaseItem): TreeItem {
136108
const item = new TreeItem(element.name);
137109
if (element === this.currentDatabaseItem) {
138-
item.iconPath = joinThemableIconPath(
139-
this.extensionPath,
140-
SELECTED_DATABASE_ICON,
141-
);
110+
item.iconPath = new ThemeIcon("check");
111+
142112
item.contextValue = "currentDatabase";
143113
} else if (element.error !== undefined) {
144-
item.iconPath = joinThemableIconPath(
145-
this.extensionPath,
146-
INVALID_DATABASE_ICON,
147-
);
114+
item.iconPath = new ThemeIcon("error", new ThemeColor("errorForeground"));
148115
}
149116
item.tooltip = element.databaseUri.fsPath;
150117
item.description = element.language;
@@ -229,7 +196,7 @@ export class DatabaseUI extends DisposableObject {
229196
super();
230197

231198
this.treeDataProvider = this.push(
232-
new DatabaseTreeDataProvider(databaseManager, extensionPath),
199+
new DatabaseTreeDataProvider(databaseManager),
233200
);
234201
this.push(
235202
window.createTreeView("codeQLDatabases", {

0 commit comments

Comments
 (0)