mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Adds message in custom view if no remotes
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Arrays, Iterables } from '../system';
|
import { Arrays, Iterables } from '../system';
|
||||||
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
||||||
import { ExplorerNode, ResourceType } from './explorerNode';
|
import { ExplorerNode, MessageNode, ResourceType } from './explorerNode';
|
||||||
import { GitService, GitUri } from '../gitService';
|
import { GitService, GitUri } from '../gitService';
|
||||||
import { RemoteNode } from './remoteNode';
|
import { RemoteNode } from './remoteNode';
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ export class RemotesNode extends ExplorerNode {
|
|||||||
|
|
||||||
async getChildren(): Promise<ExplorerNode[]> {
|
async getChildren(): Promise<ExplorerNode[]> {
|
||||||
const remotes = Arrays.uniqueBy(await this.git.getRemotes(this.uri.repoPath!), r => r.url, r => !!r.provider);
|
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));
|
remotes.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
return [...Iterables.map(remotes, r => new RemoteNode(r, this.uri, this.context, this.git))];
|
return [...Iterables.map(remotes, r => new RemoteNode(r, this.uri, this.context, this.git))];
|
||||||
|
|||||||
Reference in New Issue
Block a user