Adds an experimental custom view (wip)

This commit is contained in:
Eric Amodio
2017-06-12 12:25:09 -04:00
parent 3081632815
commit c812a56eac
20 changed files with 1939 additions and 1401 deletions

View File

@@ -0,0 +1,40 @@
'use strict';
import { Command, ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CommitFileNode } from './commitFileNode';
import { ExplorerNode, ResourceType } from './explorerNode';
import { CommitFormatter, GitService, GitStashCommit, GitUri } from '../gitService';
export class StashCommitNode extends ExplorerNode {
readonly resourceType: ResourceType = 'stash-commit';
command: Command;
constructor(public commit: GitStashCommit, uri: GitUri, context: ExtensionContext, git: GitService) {
super(uri, context, git);
// this.command = {
// title: 'Show Stash Details',
// command: Commands.ShowQuickCommitDetails,
// arguments: [
// new GitUri(commit.uri, commit),
// {
// commit: commit,
// sha: commit.sha
// } as ShowQuickCommitDetailsCommandArgs
// ]
// };
}
getChildren(): Promise<CommitFileNode[]> {
return Promise.resolve((this.commit as GitStashCommit).fileStatuses.map(_ => new CommitFileNode(_, this.commit, this.uri, this.context, this.git)));
}
getTreeItem(): TreeItem {
const label = CommitFormatter.fromTemplate(this.git.config.explorer.stashFormat, this.commit, this.git.config.defaultDateFormat);
const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed);
item.contextValue = this.resourceType;
item.command = this.command;
return item;
}
}