Skip to content

Commit

Permalink
Revert "API proposal for tree item icon color"
Browse files Browse the repository at this point in the history
This reverts commit 52e557f.
  • Loading branch information
sbatten committed Sep 12, 2020
1 parent cc899f1 commit cca20eb
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 19 deletions.
5 changes: 0 additions & 5 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1025,11 +1025,6 @@ declare module 'vscode' {
*/
tooltip?: string | MarkdownString | /* for compilation */ any;

/**
* When `iconPath` is a [ThemeColor](#ThemeColor) `iconColor` will be used to set the color of the icon.
*/
iconColor?: ThemeColor;

/**
* @param label Label describing this item
* @param collapsibleState [TreeItemCollapsibleState](#TreeItemCollapsibleState) of the tree item. Default is [TreeItemCollapsibleState.None](#TreeItemCollapsibleState.None)
Expand Down
8 changes: 1 addition & 7 deletions src/vs/workbench/api/common/extHostTreeViews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ExtHostTreeViewsShape, MainThreadTreeViewsShape } from './extHost.proto
import { ITreeItem, TreeViewItemHandleArg, ITreeItemLabel, IRevealOptions } from 'vs/workbench/common/views';
import { ExtHostCommands, CommandsConverter } from 'vs/workbench/api/common/extHostCommands';
import { asPromise } from 'vs/base/common/async';
import { TreeItemCollapsibleState, ThemeIcon, MarkdownString as MarkdownStringType, ThemeColor } from 'vs/workbench/api/common/extHostTypes';
import { TreeItemCollapsibleState, ThemeIcon, MarkdownString as MarkdownStringType } from 'vs/workbench/api/common/extHostTypes';
import { isUndefinedOrNull, isString } from 'vs/base/common/types';
import { equals, coalesce } from 'vs/base/common/arrays';
import { ILogService } from 'vs/platform/log/common/log';
Expand Down Expand Up @@ -550,7 +550,6 @@ class ExtHostTreeView<T> extends Disposable {
icon,
iconDark: this.getDarkIconPath(extensionTreeItem) || icon,
themeIcon: extensionTreeItem.iconPath instanceof ThemeIcon ? { id: extensionTreeItem.iconPath.id } : undefined,
iconColor: this.getIconColor(extensionTreeItem),
collapsibleState: isUndefinedOrNull(extensionTreeItem.collapsibleState) ? TreeItemCollapsibleState.None : extensionTreeItem.collapsibleState,
accessibilityInformation: extensionTreeItem.accessibilityInformation
};
Expand All @@ -564,11 +563,6 @@ class ExtHostTreeView<T> extends Disposable {
};
}

private getIconColor(extensionTreeItem: vscode.TreeItem2): ThemeColor | undefined {
checkProposedApiEnabled(this.extension);
return (extensionTreeItem.iconPath instanceof ThemeIcon) ? <ThemeColor>extensionTreeItem.iconColor : undefined;
}

private createHandle(element: T, { id, label, resourceUri }: vscode.TreeItem, parent: TreeNode | Root, returnFirst?: boolean): TreeItemHandle {
if (id) {
return `${ExtHostTreeView.ID_HANDLE_PREFIX}/${id}`;
Expand Down
5 changes: 1 addition & 4 deletions src/vs/workbench/common/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { RawContextKey, ContextKeyExpression } from 'vs/platform/contextkey/comm
import { localize } from 'vs/nls';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IDisposable, Disposable, toDisposable } from 'vs/base/common/lifecycle';
import { ThemeColor, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { getOrSet } from 'vs/base/common/map';
import { Registry } from 'vs/platform/registry/common/platform';
import { IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry';
Expand Down Expand Up @@ -644,8 +644,6 @@ export interface ITreeItem {

themeIcon?: ThemeIcon;

iconColor?: ThemeColor;

resourceUri?: UriComponents;

tooltip?: string | IMarkdownString;
Expand All @@ -668,7 +666,6 @@ export class ResolvableTreeItem implements ITreeItem {
icon?: UriComponents;
iconDark?: UriComponents;
themeIcon?: ThemeIcon;
iconColor?: ThemeColor;
resourceUri?: UriComponents;
tooltip?: string | IMarkdownString;
contextValue?: string;
Expand Down
3 changes: 0 additions & 3 deletions src/vs/workbench/contrib/views/browser/treeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,6 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
let iconClass: string | undefined;
if (node.themeIcon && !this.isFileKindThemeIcon(node.themeIcon)) {
iconClass = ThemeIcon.asClassName(node.themeIcon);
if (node.iconColor) {
templateData.icon.style.color = this.themeService.getColorTheme().getColor(node.iconColor.id)?.toString() ?? '';
}
}
templateData.icon.className = iconClass ? `custom-view-tree-node-item-icon ${iconClass}` : '';
templateData.icon.style.backgroundImage = '';
Expand Down

1 comment on commit cca20eb

@sbatten
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi @alexr00 re #6499

Please sign in to comment.