Defers command construction until later

Gets a properly constructed commit to improve performance of opening the diff
This commit is contained in:
Eric Amodio
2017-06-14 02:04:59 -04:00
parent da450a614d
commit bc21272409
3 changed files with 32 additions and 48 deletions

View File

@@ -1,6 +1,6 @@
'use strict';
import { Iterables } from '../system';
import { Command, ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ExtensionContext, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CommitFileNode } from './commitFileNode';
import { ExplorerNode, ResourceType } from './explorerNode';
import { CommitFormatter, GitCommit, GitService, GitUri } from '../gitService';
@@ -8,25 +8,9 @@ import { CommitFormatter, GitCommit, GitService, GitUri } from '../gitService';
export class CommitNode extends ExplorerNode {
readonly resourceType: ResourceType = 'commit';
command: Command;
constructor(public commit: GitCommit, uri: GitUri, context: ExtensionContext, git: GitService) {
super(uri, context, git);
// this.command = {
// title: 'Compare File with Previous',
// command: Commands.DiffWithPrevious,
// arguments: [
// Uri.file(commit.uri.fsPath),
// {
// commit: commit,
// showOptions: {
// preserveFocus: true,
// preview: true
// }
// } as DiffWithPreviousCommandArgs
// ]
// };
}
async getChildren(): Promise<ExplorerNode[]> {
@@ -48,7 +32,6 @@ export class CommitNode extends ExplorerNode {
dark: this.context.asAbsolutePath('images/dark/icon-commit.svg'),
light: this.context.asAbsolutePath('images/light/icon-commit.svg')
};
item.command = this.command;
return item;
}
}