@@ -64,7 +64,6 @@ import { Extensions, ITreeItem, ITreeItemLabel, ITreeView, ITreeViewDataProvider
64
64
import { IActivityService , NumberBadge } from 'vs/workbench/services/activity/common/activity' ;
65
65
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions' ;
66
66
import { IHoverService } from 'vs/workbench/services/hover/browser/hover' ;
67
- import { ThemeSettings } from 'vs/workbench/services/themes/common/workbenchThemeService' ;
68
67
import { ITreeViewsService } from 'vs/workbench/services/views/browser/treeViewsService' ;
69
68
import { CodeDataTransfers } from 'vs/platform/dnd/browser/dnd' ;
70
69
import { createFileDataTransferItemFromFile } from 'vs/editor/browser/dnd' ;
@@ -1016,7 +1015,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
1016
1015
return ( { start, end } ) ;
1017
1016
} ) : undefined ;
1018
1017
const icon = this . themeService . getColorTheme ( ) . type === ColorScheme . LIGHT ? node . icon : node . iconDark ;
1019
- const iconUrl = icon ? URI . revive ( icon ) : null ;
1018
+ const iconUrl = icon ? URI . revive ( icon ) : undefined ;
1020
1019
const title = this . getHover ( label , resource , node ) ;
1021
1020
1022
1021
// reset
@@ -1029,7 +1028,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
1029
1028
templateData . resourceLabel . setResource ( { name : label , description, resource : labelResource } , {
1030
1029
fileKind : this . getFileKind ( node ) ,
1031
1030
title,
1032
- hideIcon : ! ! iconUrl || this . shouldShowThemeIcon ( ! ! resource , node . themeIcon ) ,
1031
+ hideIcon : this . shouldHideResourceLabelIcon ( iconUrl , node . themeIcon ) ,
1033
1032
fileDecorations,
1034
1033
extraClasses : [ 'custom-view-tree-node-item-resourceLabel' ] ,
1035
1034
matches : matches ? matches : createMatches ( element . filterData ) ,
@@ -1050,8 +1049,6 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
1050
1049
templateData . icon . style . backgroundImage = DOM . asCSSUrl ( iconUrl ) ;
1051
1050
} else {
1052
1051
let iconClass : string | undefined ;
1053
- // If there is a resource for this tree item then we should respect the file icon theme's choice about
1054
- // whether to show a folder icon.
1055
1052
if ( this . shouldShowThemeIcon ( ! ! resource , node . themeIcon ) ) {
1056
1053
iconClass = ThemeIcon . asClassName ( node . themeIcon ) ;
1057
1054
if ( node . themeIcon . color ) {
@@ -1084,25 +1081,20 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
1084
1081
container . parentElement ! . classList . toggle ( 'align-icon-with-twisty' , this . aligner . alignIconWithTwisty ( treeItem ) ) ;
1085
1082
}
1086
1083
1084
+ private shouldHideResourceLabelIcon ( iconUrl : URI | undefined , icon : ThemeIcon | undefined ) : boolean {
1085
+ // We always hide the resource label in favor of the iconUrl when it's provided.
1086
+ // When `ThemeIcon` is provided, we hide the resource label icon in favor of it only if it's a not a file icon.
1087
+ return ! ! iconUrl || ! this . isFileKindThemeIcon ( icon ) ;
1088
+ }
1089
+
1087
1090
private shouldShowThemeIcon ( hasResource : boolean , icon : ThemeIcon | undefined ) : icon is ThemeIcon {
1088
1091
if ( ! icon ) {
1089
1092
return false ;
1090
1093
}
1091
1094
1092
- if ( hasResource && this . isFileKindThemeIcon ( icon ) ) {
1093
- return ! this . shouldShowFileIcons ( ) ;
1094
- } else if ( hasResource && this . isFolderThemeIcon ( icon ) ) {
1095
- return ! this . shouldShowFolderIcons ( ) ;
1096
- }
1097
- return true ;
1098
- }
1099
-
1100
- private shouldShowFileIcons ( ) : boolean {
1101
- return this . configurationService . getValue ( ThemeSettings . FILE_ICON_THEME ) ;
1102
- }
1103
-
1104
- private shouldShowFolderIcons ( ) : boolean {
1105
- return this . themeService . getFileIconTheme ( ) . hasFolderIcons && this . shouldShowFileIcons ( ) ;
1095
+ // If there's a resource and the icon is a file icon, then the icon (or lack thereof) will already be coming from the
1096
+ // icon theme and should use whatever the icon theme has provided.
1097
+ return ! ( hasResource && this . isFileKindThemeIcon ( icon ) ) ;
1106
1098
}
1107
1099
1108
1100
private isFolderThemeIcon ( icon : ThemeIcon | undefined ) : boolean {
0 commit comments