@@ -43,6 +43,7 @@ import { basename } from '../../../../base/common/resources.js';
4343import { ICompressibleTreeRenderer } from '../../../../base/browser/ui/tree/objectTree.js' ;
4444import { ICompressedTreeNode } from '../../../../base/browser/ui/tree/compressedObjectTreeModel.js' ;
4545import { ITreeCompressionDelegate } from '../../../../base/browser/ui/tree/asyncDataTree.js' ;
46+ import { Codicon } from '../../../../base/common/codicons.js' ;
4647
4748type TreeElement = ISCMRepository | SCMArtifactGroupTreeElement | SCMArtifactTreeElement | IResourceNode < SCMArtifactTreeElement , SCMArtifactGroupTreeElement > ;
4849
@@ -66,6 +67,7 @@ class ListDelegate implements IListVirtualDelegate<ISCMRepository> {
6667}
6768
6869interface ArtifactGroupTemplate {
70+ readonly icon : HTMLElement ;
6971 readonly label : IconLabel ;
7072 readonly actionBar : WorkbenchToolBar ;
7173 readonly elementDisposables : DisposableStore ;
@@ -89,21 +91,23 @@ class ArtifactGroupRenderer implements ICompressibleTreeRenderer<SCMArtifactGrou
8991
9092 renderTemplate ( container : HTMLElement ) : ArtifactGroupTemplate {
9193 const element = append ( container , $ ( '.scm-artifact-group' ) ) ;
92- const label = new IconLabel ( element , { supportIcons : true } ) ;
94+ const icon = append ( element , $ ( '.icon' ) ) ;
95+ const label = new IconLabel ( element , { supportIcons : false } ) ;
9396
9497 const actionsContainer = append ( element , $ ( '.actions' ) ) ;
9598 const actionBar = new WorkbenchToolBar ( actionsContainer , undefined , this . _menuService , this . _contextKeyService , this . _contextMenuService , this . _keybindingService , this . _commandService , this . _telemetryService ) ;
9699
97- return { label, actionBar, elementDisposables : new DisposableStore ( ) , templateDisposable : combinedDisposable ( label , actionBar ) } ;
100+ return { icon , label, actionBar, elementDisposables : new DisposableStore ( ) , templateDisposable : combinedDisposable ( label , actionBar ) } ;
98101 }
99102
100103 renderElement ( node : ITreeNode < SCMArtifactGroupTreeElement , FuzzyScore > , index : number , templateData : ArtifactGroupTemplate ) : void {
101104 const provider = node . element . repository . provider ;
102105 const artifactGroup = node . element . artifactGroup ;
103- const artifactGroupIcon = ThemeIcon . isThemeIcon ( artifactGroup . icon )
104- ? `$(${ artifactGroup . icon . id } ) ` : '' ;
105106
106- templateData . label . setLabel ( `${ artifactGroupIcon } ${ artifactGroup . name } ` ) ;
107+ templateData . icon . className = ThemeIcon . isThemeIcon ( artifactGroup . icon )
108+ ? `icon ${ ThemeIcon . asClassName ( artifactGroup . icon ) } `
109+ : '' ;
110+ templateData . label . setLabel ( artifactGroup . name ) ;
107111
108112 const repositoryMenus = this . _scmViewService . menus . getRepositoryMenus ( provider ) ;
109113 templateData . elementDisposables . add ( connectPrimaryMenu ( repositoryMenus . getArtifactGroupMenu ( artifactGroup ) , primary => {
@@ -127,6 +131,7 @@ class ArtifactGroupRenderer implements ICompressibleTreeRenderer<SCMArtifactGrou
127131}
128132
129133interface ArtifactTemplate {
134+ readonly icon : HTMLElement ;
130135 readonly label : IconLabel ;
131136 readonly actionBar : WorkbenchToolBar ;
132137 readonly elementDisposables : DisposableStore ;
@@ -150,32 +155,35 @@ class ArtifactRenderer implements ICompressibleTreeRenderer<SCMArtifactTreeEleme
150155
151156 renderTemplate ( container : HTMLElement ) : ArtifactTemplate {
152157 const element = append ( container , $ ( '.scm-artifact' ) ) ;
153- const label = new IconLabel ( element , { supportIcons : true } ) ;
158+ const icon = append ( element , $ ( '.icon' ) ) ;
159+ const label = new IconLabel ( element , { supportIcons : false } ) ;
154160
155161 const actionsContainer = append ( element , $ ( '.actions' ) ) ;
156162 const actionBar = new WorkbenchToolBar ( actionsContainer , undefined , this . _menuService , this . _contextKeyService , this . _contextMenuService , this . _keybindingService , this . _commandService , this . _telemetryService ) ;
157163
158- return { label, actionBar, elementDisposables : new DisposableStore ( ) , templateDisposable : combinedDisposable ( label , actionBar ) } ;
164+ return { icon , label, actionBar, elementDisposables : new DisposableStore ( ) , templateDisposable : combinedDisposable ( label , actionBar ) } ;
159165 }
160166
161167 renderElement ( nodeOrElement : ITreeNode < SCMArtifactTreeElement | IResourceNode < SCMArtifactTreeElement , SCMArtifactGroupTreeElement > , FuzzyScore > , index : number , templateData : ArtifactTemplate ) : void {
162168 const artifactOrFolder = nodeOrElement . element ;
163169
164170 if ( isSCMArtifactNode ( artifactOrFolder ) ) {
165171 // Folder
166- templateData . label . setLabel ( `$(folder) ${ basename ( artifactOrFolder . uri ) } ` ) ;
172+ templateData . icon . className = `icon ${ ThemeIcon . asClassName ( Codicon . folder ) } ` ;
173+ templateData . label . setLabel ( basename ( artifactOrFolder . uri ) ) ;
167174
168175 templateData . actionBar . setActions ( [ ] ) ;
169176 templateData . actionBar . context = undefined ;
170177 } else {
171178 // Artifact
172179 const artifact = artifactOrFolder . artifact ;
173- const artifactIcon = ThemeIcon . isThemeIcon ( artifactOrFolder . group . icon )
174- ? `$(${ artifactOrFolder . group . icon . id } ) `
180+
181+ templateData . icon . className = ThemeIcon . isThemeIcon ( artifactOrFolder . group . icon )
182+ ? `icon ${ ThemeIcon . asClassName ( artifactOrFolder . group . icon ) } `
175183 : '' ;
176184
177185 const artifactLabel = artifact . name . split ( '/' ) . pop ( ) ?? artifact . name ;
178- templateData . label . setLabel ( ` ${ artifactIcon } ${ artifactLabel } ` , artifact . description ) ;
186+ templateData . label . setLabel ( artifactLabel , artifact . description ) ;
179187
180188 const provider = artifactOrFolder . repository . provider ;
181189 const repositoryMenus = this . _scmViewService . menus . getRepositoryMenus ( provider ) ;
@@ -187,12 +195,30 @@ class ArtifactRenderer implements ICompressibleTreeRenderer<SCMArtifactTreeEleme
187195 }
188196
189197 renderCompressedElements ( node : ITreeNode < ICompressedTreeNode < SCMArtifactTreeElement | IResourceNode < SCMArtifactTreeElement , SCMArtifactGroupTreeElement > > , FuzzyScore > , index : number , templateData : ArtifactTemplate , details ?: ITreeElementRenderDetails ) : void {
190- const compressed = node . element as ICompressedTreeNode < IResourceNode < SCMArtifactTreeElement , SCMArtifactGroupTreeElement > > ;
191- const folder = compressed . elements [ compressed . elements . length - 1 ] ;
192- templateData . label . setLabel ( `$(folder) ${ folder . uri . fsPath . substring ( 1 ) } ` ) ;
198+ const compressed = node . element ;
199+ const artifactOrFolder = compressed . elements [ compressed . elements . length - 1 ] ;
200+
201+ if ( isSCMArtifactTreeElement ( artifactOrFolder ) ) {
202+ const artifact = artifactOrFolder . artifact ;
203+
204+ templateData . icon . className = ThemeIcon . isThemeIcon ( artifactOrFolder . group . icon )
205+ ? `icon ${ ThemeIcon . asClassName ( artifactOrFolder . group . icon ) } `
206+ : '' ;
207+ templateData . label . setLabel ( artifact . name , artifact . description ) ;
208+
209+ const provider = artifactOrFolder . repository . provider ;
210+ const repositoryMenus = this . _scmViewService . menus . getRepositoryMenus ( provider ) ;
211+ templateData . elementDisposables . add ( connectPrimaryMenu ( repositoryMenus . getArtifactMenu ( artifactOrFolder . group ) , primary => {
212+ templateData . actionBar . setActions ( primary ) ;
213+ } , 'inline' , provider ) ) ;
214+ templateData . actionBar . context = artifact ;
215+ } else if ( ResourceTree . isResourceNode ( artifactOrFolder ) ) {
216+ templateData . icon . className = `icon ${ ThemeIcon . asClassName ( Codicon . folder ) } ` ;
217+ templateData . label . setLabel ( artifactOrFolder . uri . fsPath . substring ( 1 ) ) ;
193218
194- templateData . actionBar . setActions ( [ ] ) ;
195- templateData . actionBar . context = undefined ;
219+ templateData . actionBar . setActions ( [ ] ) ;
220+ templateData . actionBar . context = undefined ;
221+ }
196222 }
197223
198224 disposeElement ( element : ITreeNode < SCMArtifactTreeElement | IResourceNode < SCMArtifactTreeElement , SCMArtifactGroupTreeElement > , FuzzyScore > , index : number , templateData : ArtifactTemplate , details ?: ITreeElementRenderDetails ) : void {
@@ -306,10 +332,10 @@ class RepositoryTreeIdentityProvider implements IIdentityProvider<TreeElement> {
306332class RepositoriesTreeCompressionDelegate implements ITreeCompressionDelegate < TreeElement > {
307333 isIncompressible ( element : TreeElement ) : boolean {
308334 if ( ResourceTree . isResourceNode ( element ) ) {
309- return element . childrenCount === 0 || ! element . parent || ! element . parent . parent ;
335+ return element . childrenCount > 1 ;
336+ } else {
337+ return true ;
310338 }
311-
312- return true ;
313339 }
314340}
315341
@@ -440,18 +466,12 @@ export class SCMRepositoriesViewPane extends ViewPane {
440466 }
441467
442468 // Explorer mode
443- // Expand artifact folders with one child only
444469 if ( isSCMArtifactNode ( e ) ) {
445- if ( e . childrenCount !== 1 ) {
446- return true ;
447- }
448-
449- // Check if the only child is a leaf node
450- const firstChild = Iterable . first ( e . children ) ;
451- return firstChild ?. element !== undefined ;
470+ // Only expand artifact folders as they are compressed by default
471+ return ! ( e . childrenCount === 1 && Iterable . first ( e . children ) ?. element === undefined ) ;
472+ } else {
473+ return true ;
452474 }
453-
454- return true ;
455475 } ,
456476 compressionEnabled : true ,
457477 overrideStyles : this . getLocationBasedColors ( ) . listOverrideStyles ,
0 commit comments