浏览代码

Adds message in custom view if no remotes

main
Eric Amodio 7 年前
父节点
当前提交
a5af318269
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      src/views/remotesNode.ts

+ 2
- 2
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<ExplorerNode[]> {
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))];

正在加载...
取消
保存