From a5af3182699c48d78182fa3cef19071f14a7ac3f Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 4 Sep 2017 01:33:15 -0400 Subject: [PATCH] Adds message in custom view if no remotes --- src/views/remotesNode.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/remotesNode.ts b/src/views/remotesNode.ts index be7852b..309c9f2 100644 --- a/src/views/remotesNode.ts +++ b/src/views/remotesNode.ts @@ -1,7 +1,7 @@ 'use strict'; import { Arrays, Iterables } from '../system'; import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode'; -import { ExplorerNode, ResourceType } from './explorerNode'; +import { ExplorerNode, MessageNode, ResourceType } from './explorerNode'; import { GitService, GitUri } from '../gitService'; import { RemoteNode } from './remoteNode'; @@ -15,7 +15,7 @@ export class RemotesNode extends ExplorerNode { async getChildren(): Promise { const remotes = Arrays.uniqueBy(await this.git.getRemotes(this.uri.repoPath!), r => r.url, r => !!r.provider); - if (remotes === undefined) return []; + if (remotes === undefined || remotes.length === 0) return [new MessageNode('No remotes configured')]; remotes.sort((a, b) => a.name.localeCompare(b.name)); return [...Iterables.map(remotes, r => new RemoteNode(r, this.uri, this.context, this.git))];