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,41 @@
'use strict';
import { Command, ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Commands, DiffWithPreviousCommandArgs } from '../commands';
import { ExplorerNode, ResourceType } from './explorerNode';
import { GitCommit, GitService, GitUri, IGitStatusFile } from '../gitService';
export class CommitFileNode extends ExplorerNode {
readonly resourceType: ResourceType = 'commit-file';
command: Command;
constructor(public status: IGitStatusFile, public commit: GitCommit, uri: GitUri, context: ExtensionContext, git: GitService) {
super(uri, context, git);
this.command = {
title: 'Compare File with Previous',
command: Commands.DiffWithPrevious,
arguments: [
GitUri.fromFileStatus(this.status, this.commit.repoPath),
{
commit: commit,
showOptions: {
preserveFocus: true,
preview: true
}
} as DiffWithPreviousCommandArgs
]
};
}
getChildren(): Promise<ExplorerNode[]> {
return Promise.resolve([]);
}
getTreeItem(): TreeItem {
const item = new TreeItem(`${GitUri.getFormattedPath(this.status.fileName)}`, TreeItemCollapsibleState.None);
item.contextValue = this.resourceType;
item.command = this.command;
return item;
}
}