mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-21 09:45:37 -05:00
Spits branch and status nodes into separate files
Removes status node for now
This commit is contained in:
28
src/views/branchesNode.ts
Normal file
28
src/views/branchesNode.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
import { Iterables } from '../system';
|
||||
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
|
||||
import { BranchHistoryNode } from './branchHistoryNode';
|
||||
import { ExplorerNode, ResourceType } from './explorerNode';
|
||||
import { GitService, GitUri } from '../gitService';
|
||||
|
||||
export class BranchesNode extends ExplorerNode {
|
||||
|
||||
readonly resourceType: ResourceType = 'branches';
|
||||
|
||||
constructor(uri: GitUri, context: ExtensionContext, git: GitService) {
|
||||
super(uri, context, git);
|
||||
}
|
||||
|
||||
async getChildren(): Promise<BranchHistoryNode[]> {
|
||||
const branches = await this.git.getBranches(this.uri.repoPath!);
|
||||
if (branches === undefined) return [];
|
||||
|
||||
return [...Iterables.filterMap(branches.sort(_ => _.current ? 0 : 1), b => b.remote ? undefined : new BranchHistoryNode(b, this.uri, this.context, this.git))];
|
||||
}
|
||||
|
||||
getTreeItem(): TreeItem {
|
||||
const item = new TreeItem(`Branches`, TreeItemCollapsibleState.Collapsed);
|
||||
item.contextValue = this.resourceType;
|
||||
return item;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user