Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/vs
diff options
context:
space:
mode:
authorAlex Ross <alros@microsoft.com>2022-06-07 22:59:28 +0300
committerGitHub <noreply@github.com>2022-06-07 22:59:28 +0300
commit413100c720e69b0c28771ddb272c428d3fab9a4d (patch)
treed4676ca23ef1c232357ee7842755703b545e1274 /src/vs
parentcfecdd54612140a54d29d591a9c27ae92316417d (diff)
References view shows icons even though I have icons disabled (#151420) (#151424)
Fixes #151406
Diffstat (limited to 'src/vs')
-rw-r--r--src/vs/workbench/browser/parts/views/treeView.ts30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/vs/workbench/browser/parts/views/treeView.ts b/src/vs/workbench/browser/parts/views/treeView.ts
index 64ce4c648e5..239d853d247 100644
--- a/src/vs/workbench/browser/parts/views/treeView.ts
+++ b/src/vs/workbench/browser/parts/views/treeView.ts
@@ -64,7 +64,6 @@ import { Extensions, ITreeItem, ITreeItemLabel, ITreeView, ITreeViewDataProvider
import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IHoverService } from 'vs/workbench/services/hover/browser/hover';
-import { ThemeSettings } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { ITreeViewsService } from 'vs/workbench/services/views/browser/treeViewsService';
import { CodeDataTransfers } from 'vs/platform/dnd/browser/dnd';
import { createFileDataTransferItemFromFile } from 'vs/editor/browser/dnd';
@@ -1019,7 +1018,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
return ({ start, end });
}) : undefined;
const icon = this.themeService.getColorTheme().type === ColorScheme.LIGHT ? node.icon : node.iconDark;
- const iconUrl = icon ? URI.revive(icon) : null;
+ const iconUrl = icon ? URI.revive(icon) : undefined;
const title = this.getHover(label, resource, node);
// reset
@@ -1032,7 +1031,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
templateData.resourceLabel.setResource({ name: label, description, resource: labelResource }, {
fileKind: this.getFileKind(node),
title,
- hideIcon: !!iconUrl || this.shouldShowThemeIcon(!!resource, node.themeIcon),
+ hideIcon: this.shouldHideResourceLabelIcon(iconUrl, node.themeIcon),
fileDecorations,
extraClasses: ['custom-view-tree-node-item-resourceLabel'],
matches: matches ? matches : createMatches(element.filterData),
@@ -1053,8 +1052,6 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
templateData.icon.style.backgroundImage = DOM.asCSSUrl(iconUrl);
} else {
let iconClass: string | undefined;
- // If there is a resource for this tree item then we should respect the file icon theme's choice about
- // whether to show a folder icon.
if (this.shouldShowThemeIcon(!!resource, node.themeIcon)) {
iconClass = ThemeIcon.asClassName(node.themeIcon);
if (node.themeIcon.color) {
@@ -1087,25 +1084,20 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
container.parentElement!.classList.toggle('align-icon-with-twisty', this.aligner.alignIconWithTwisty(treeItem));
}
+ private shouldHideResourceLabelIcon(iconUrl: URI | undefined, icon: ThemeIcon | undefined): boolean {
+ // We always hide the resource label in favor of the iconUrl when it's provided.
+ // When `ThemeIcon` is provided, we hide the resource label icon in favor of it only if it's a not a file icon.
+ return !!iconUrl || !this.isFileKindThemeIcon(icon);
+ }
+
private shouldShowThemeIcon(hasResource: boolean, icon: ThemeIcon | undefined): icon is ThemeIcon {
if (!icon) {
return false;
}
- if (hasResource && this.isFileKindThemeIcon(icon)) {
- return !this.shouldShowFileIcons();
- } else if (hasResource && this.isFolderThemeIcon(icon)) {
- return !this.shouldShowFolderIcons();
- }
- return true;
- }
-
- private shouldShowFileIcons(): boolean {
- return this.configurationService.getValue(ThemeSettings.FILE_ICON_THEME);
- }
-
- private shouldShowFolderIcons(): boolean {
- return this.themeService.getFileIconTheme().hasFolderIcons && this.shouldShowFileIcons();
+ // If there's a resource and the icon is a file icon, then the icon (or lack thereof) will already be coming from the
+ // icon theme and should use whatever the icon theme has provided.
+ return !(hasResource && this.isFileKindThemeIcon(icon));
}
private isFolderThemeIcon(icon: ThemeIcon | undefined): boolean {