mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-23 17:26:14 -05:00
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:
@@ -1,15 +1,16 @@
|
||||
'use strict';
|
||||
import { Arrays, Iterables } from '../system';
|
||||
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
|
||||
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffDirectoryCommandCommandArgs, Keyboard, KeyNoopCommand, ShowQuickCommitDetailsCommandArgs, StashApplyCommandArgs, StashDeleteCommandArgs } from '../commands';
|
||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem, OpenFilesCommandQuickPickItem } from './common';
|
||||
import { getGitStatusIcon, GitCommit, GitLogCommit, GitService, GitStashCommit, GitStatusFileStatus, GitUri, IGitLog, IGitStatusFile, RemoteResource } from '../gitService';
|
||||
import { commands, QuickPickOptions, TextDocumentShowOptions, Uri, window } from 'vscode';
|
||||
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffDirectoryCommandCommandArgs, DiffWithPreviousCommandArgs, Keyboard, KeyNoopCommand, Keys, ShowQuickCommitDetailsCommandArgs, StashApplyCommandArgs, StashDeleteCommandArgs } from '../commands';
|
||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem, OpenFilesCommandQuickPickItem, QuickPickItem } from './common';
|
||||
import { getGitStatusIcon, GitCommit, GitLogCommit, GitService, GitStashCommit, GitStatusFileStatus, GitUri, IGitCommitInfo, IGitLog, IGitStatusFile, RemoteResource } from '../gitService';
|
||||
import { OpenRemotesCommandQuickPickItem } from './remotes';
|
||||
import * as moment from 'moment';
|
||||
import * as path from 'path';
|
||||
|
||||
export class CommitWithFileStatusQuickPickItem extends OpenFileCommandQuickPickItem {
|
||||
|
||||
private commit: GitCommit;
|
||||
fileName: string;
|
||||
gitUri: GitUri;
|
||||
sha: string;
|
||||
@@ -44,12 +45,32 @@ export class CommitWithFileStatusQuickPickItem extends OpenFileCommandQuickPickI
|
||||
description: description
|
||||
});
|
||||
|
||||
this.commit = commit;
|
||||
this.fileName = status.fileName;
|
||||
this.gitUri = GitUri.fromFileStatus(status, commit.repoPath);
|
||||
this.gitUri = GitUri.fromFileStatus(status, {
|
||||
fileName: status.fileName,
|
||||
repoPath: commit.repoPath,
|
||||
sha: commit.sha,
|
||||
originalFileName: status.originalFileName
|
||||
} as IGitCommitInfo);
|
||||
this.sha = sha;
|
||||
this.shortSha = shortSha;
|
||||
this.status = status.status;
|
||||
}
|
||||
|
||||
onDidPressKey(key: Keys): Promise<{} | undefined> {
|
||||
if (this.commit.previousSha === undefined) return super.onDidPressKey(key);
|
||||
|
||||
return commands.executeCommand(Commands.DiffWithPrevious,
|
||||
this.gitUri,
|
||||
{
|
||||
commit: this.commit,
|
||||
showOptions: {
|
||||
preserveFocus: true,
|
||||
preview: false
|
||||
} as TextDocumentShowOptions
|
||||
} as DiffWithPreviousCommandArgs) as Promise<{} | undefined>;
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenCommitFilesCommandQuickPickItem extends OpenFilesCommandQuickPickItem {
|
||||
@@ -288,6 +309,9 @@ export class CommitDetailsQuickPick {
|
||||
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
|
||||
onDidSelectItem: (item: QuickPickItem) => {
|
||||
scope.setKeyCommand('right', item);
|
||||
if (typeof item.onDidSelect === 'function') {
|
||||
item.onDidSelect();
|
||||
}
|
||||
}
|
||||
} as QuickPickOptions);
|
||||
|
||||
|
||||
@@ -120,12 +120,12 @@ export class OpenFileCommandQuickPickItem extends CommandQuickPickItem {
|
||||
return openEditor(this.uri, options);
|
||||
}
|
||||
|
||||
onDidSelect(): Promise<{} | undefined> {
|
||||
return this.execute({
|
||||
preserveFocus: true,
|
||||
preview: true
|
||||
});
|
||||
}
|
||||
// onDidSelect(): Promise<{} | undefined> {
|
||||
// return this.execute({
|
||||
// preserveFocus: true,
|
||||
// preview: true
|
||||
// });
|
||||
// }
|
||||
|
||||
onDidPressKey(key: Keys): Promise<{} | undefined> {
|
||||
return this.execute({
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
import { Iterables } from '../system';
|
||||
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
|
||||
import { Commands, Keyboard, OpenChangedFilesCommandArgs, ShowQuickBranchHistoryCommandArgs, ShowQuickRepoStatusCommandArgs, ShowQuickStashListCommandArgs } from '../commands';
|
||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, OpenFileCommandQuickPickItem } from './common';
|
||||
import { commands, QuickPickOptions, TextDocumentShowOptions, Uri, window } from 'vscode';
|
||||
import { Commands, DiffWithWorkingCommandArgs, Keyboard, Keys, OpenChangedFilesCommandArgs, ShowQuickBranchHistoryCommandArgs, ShowQuickRepoStatusCommandArgs, ShowQuickStashListCommandArgs } from '../commands';
|
||||
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, OpenFileCommandQuickPickItem, QuickPickItem } from './common';
|
||||
import { GitService, GitStatusFile, GitUri, IGitStatus } from '../gitService';
|
||||
import * as path from 'path';
|
||||
|
||||
@@ -25,6 +25,17 @@ export class OpenStatusFileCommandQuickPickItem extends OpenFileCommandQuickPick
|
||||
description: description
|
||||
});
|
||||
}
|
||||
|
||||
onDidPressKey(key: Keys): Promise<{} | undefined> {
|
||||
return commands.executeCommand(Commands.DiffWithWorking,
|
||||
this.uri,
|
||||
{
|
||||
showOptions: {
|
||||
preserveFocus: true,
|
||||
preview: false
|
||||
} as TextDocumentShowOptions
|
||||
} as DiffWithWorkingCommandArgs) as Promise<{} | undefined>;
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenStatusFilesCommandQuickPickItem extends CommandQuickPickItem {
|
||||
|
||||
Reference in New Issue
Block a user