Add color to ThemeIcon (#106491)

Part of #103120
This commit is contained in:
Alex Ross
2020-09-16 11:20:52 +02:00
committed by GitHub
parent c6cada990b
commit 10c7db89ee
6 changed files with 31 additions and 4 deletions

View File

@@ -556,7 +556,7 @@ class ExtHostTreeView<T> extends Disposable {
const disposable = new DisposableStore();
const handle = this.createHandle(element, extensionTreeItem, parent);
const icon = this.getLightIconPath(extensionTreeItem);
const item = {
const item: ITreeItem = {
handle,
parentHandle: parent ? parent.item.handle : undefined,
label: toTreeItemLabel(extensionTreeItem.label, this.extension),
@@ -567,7 +567,7 @@ class ExtHostTreeView<T> extends Disposable {
contextValue: extensionTreeItem.contextValue,
icon,
iconDark: this.getDarkIconPath(extensionTreeItem) || icon,
themeIcon: extensionTreeItem.iconPath instanceof ThemeIcon ? { id: extensionTreeItem.iconPath.id } : undefined,
themeIcon: this.getThemeIcon(extensionTreeItem),
collapsibleState: isUndefinedOrNull(extensionTreeItem.collapsibleState) ? TreeItemCollapsibleState.None : extensionTreeItem.collapsibleState,
accessibilityInformation: extensionTreeItem.accessibilityInformation
};
@@ -581,6 +581,13 @@ class ExtHostTreeView<T> extends Disposable {
};
}
private getThemeIcon(extensionTreeItem: vscode.TreeItem2): ThemeIcon | undefined {
if ((extensionTreeItem.iconPath instanceof ThemeIcon) && extensionTreeItem.iconPath.themeColor) {
checkProposedApiEnabled(this.extension);
}
return extensionTreeItem.iconPath instanceof ThemeIcon ? extensionTreeItem.iconPath : undefined;
}
private createHandle(element: T, { id, label, resourceUri }: vscode.TreeItem, parent: TreeNode | Root, returnFirst?: boolean): TreeItemHandle {
if (id) {
return `${ExtHostTreeView.ID_HANDLE_PREFIX}/${id}`;