diff --git a/extensions/git/src/artifactProvider.ts b/extensions/git/src/artifactProvider.ts index f48d3d74d1a..f6e4c255918 100644 --- a/extensions/git/src/artifactProvider.ts +++ b/extensions/git/src/artifactProvider.ts @@ -82,9 +82,9 @@ export class GitArtifactProvider implements SourceControlArtifactProvider, IDisp private readonly logger: LogOutputChannel ) { this._groups = [ - { id: 'branches', name: l10n.t('Branches'), icon: new ThemeIcon('git-branch') }, - { id: 'stashes', name: l10n.t('Stashes'), icon: new ThemeIcon('git-stash') }, - { id: 'tags', name: l10n.t('Tags'), icon: new ThemeIcon('tag') } + { id: 'branches', name: l10n.t('Branches'), icon: new ThemeIcon('git-branch'), supportsFolders: true }, + { id: 'stashes', name: l10n.t('Stashes'), icon: new ThemeIcon('git-stash'), supportsFolders: false }, + { id: 'tags', name: l10n.t('Tags'), icon: new ThemeIcon('tag'), supportsFolders: true } ]; this._disposables.push(this._onDidChangeArtifacts); diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 7741ad87429..94b0a860bcc 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1752,6 +1752,7 @@ export interface SCMArtifactGroupDto { readonly id: string; readonly name: string; readonly icon?: UriComponents | { light: UriComponents; dark: UriComponents } | ThemeIcon; + readonly supportsFolders?: boolean; } export interface SCMArtifactDto { diff --git a/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.ts index cc306a6c736..754308fa34e 100644 --- a/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.ts +++ b/src/vs/workbench/contrib/scm/browser/scmRepositoriesViewPane.ts @@ -174,6 +174,7 @@ class ArtifactRenderer implements ICompressibleTreeRenderer(inputOrElement); - for (const artifact of artifacts) { - artifactsTree.add(URI.from({ - scheme: 'scm-artifact', path: artifact.name - }), { + if (inputOrElement.artifactGroup.supportsFolders) { + // Resource tree for artifacts + const artifactsTree = new ResourceTree(inputOrElement); + for (const artifact of artifacts) { + artifactsTree.add(URI.from({ + scheme: 'scm-artifact', path: artifact.name + }), { + repository, + group: inputOrElement.artifactGroup, + artifact, + type: 'artifact' + }); + } + + return Iterable.map(artifactsTree.root.children, node => node.element ?? node); + } + + // Flat list of artifacts + return artifacts.map(artifact => ( + { repository, group: inputOrElement.artifactGroup, artifact, type: 'artifact' - }); - } - - return Iterable.map(artifactsTree.root.children, node => node.element ?? node); + } satisfies SCMArtifactTreeElement + )); } else if (isSCMArtifactNode(inputOrElement)) { return Iterable.map(inputOrElement.children, node => node.element && node.childrenCount === 0 ? node.element : node); - } else if (isSCMArtifactTreeElement(inputOrElement)) { } + } return []; } diff --git a/src/vs/workbench/contrib/scm/common/artifact.ts b/src/vs/workbench/contrib/scm/common/artifact.ts index b70a5220ccc..6cee8d6b19e 100644 --- a/src/vs/workbench/contrib/scm/common/artifact.ts +++ b/src/vs/workbench/contrib/scm/common/artifact.ts @@ -18,6 +18,7 @@ export interface ISCMArtifactGroup { readonly id: string; readonly name: string; readonly icon?: URI | { light: URI; dark: URI } | ThemeIcon; + readonly supportsFolders?: boolean; } export interface ISCMArtifact { diff --git a/src/vscode-dts/vscode.proposed.scmArtifactProvider.d.ts b/src/vscode-dts/vscode.proposed.scmArtifactProvider.d.ts index 271a8d39016..6f79d3932fd 100644 --- a/src/vscode-dts/vscode.proposed.scmArtifactProvider.d.ts +++ b/src/vscode-dts/vscode.proposed.scmArtifactProvider.d.ts @@ -21,6 +21,7 @@ declare module 'vscode' { readonly id: string; readonly name: string; readonly icon?: IconPath; + readonly supportsFolders?: boolean; } export interface SourceControlArtifact {