diff --git a/src/tree/registries/UnifiedRegistryTreeDataProvider.ts b/src/tree/registries/UnifiedRegistryTreeDataProvider.ts index 55bd0344f6..f4d23218bc 100644 --- a/src/tree/registries/UnifiedRegistryTreeDataProvider.ts +++ b/src/tree/registries/UnifiedRegistryTreeDataProvider.ts @@ -31,7 +31,11 @@ export class UnifiedRegistryTreeDataProvider implements vscode.TreeDataProvider< } public getTreeItem(element: UnifiedRegistryItem): vscode.TreeItem | Thenable { - return element.provider.getTreeItem(element.wrappedItem); + if (!element.provider) { + return element.wrappedItem as vscode.TreeItem; + } else { + return element.provider.getTreeItem(element.wrappedItem); + } } public async getChildren(element?: UnifiedRegistryItem | undefined): Promise[]> { @@ -78,6 +82,22 @@ export class UnifiedRegistryTreeDataProvider implements vscode.TreeDataProvider< }; })); } + + // if there are no connected providers, show a command to connect one + if (unifiedRegistryItems.length === 0) { + unifiedRegistryItems.push({ + provider: undefined, + wrappedItem: { + label: vscode.l10n.t('Connect Registry...'), + type: 'connectregistry', + iconPath: new vscode.ThemeIcon('plug'), + command: { + command: 'vscode-docker.registries.connectRegistry' + } + }, + parent: undefined, + }); + } } return unifiedRegistryItems.sort((a, b) => {