Changes file alt+right to be a diff on commit details quick pick

Changes file alt+right to be a diff on repo status quick pick
This commit is contained in:
Eric Amodio
2017-05-15 03:09:54 -04:00
parent 4d62e5cdad
commit d35074ecf8
6 changed files with 58 additions and 22 deletions

View File

@@ -3,6 +3,7 @@ import { Iterables } from '../system';
import { commands, Range, TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
import { BuiltInCommands } from '../constants';
import { DiffWithWorkingCommandArgs } from './diffWithWorking';
import { GitCommit, GitService, GitUri } from '../gitService';
import { Logger } from '../logger';
import * as moment from 'moment';
@@ -27,13 +28,13 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
args.line = args.line || (editor === undefined ? 0 : editor.selection.active.line);
if (args.commit === undefined || args.range !== undefined) {
if (args.commit === undefined || (args.commit.type !== 'file') || args.range !== undefined) {
const gitUri = await GitUri.fromUri(uri, this.git);
try {
// If the sha is missing or the file is uncommitted, treat it as a DiffWithWorking
if (gitUri.sha === undefined && await this.git.isFileUncommitted(gitUri)) {
return commands.executeCommand(Commands.DiffWithWorking, uri);
return commands.executeCommand(Commands.DiffWithWorking, uri, { showOptions: args.showOptions } as DiffWithWorkingCommandArgs);
}
const sha = args.commit === undefined ? gitUri.sha : args.commit.sha;