Browse Source

Fixes right/left diff command issues

main
Eric Amodio 4 years ago
parent
commit
e25c154115
9 changed files with 272 additions and 68 deletions
  1. +232
    -35
      package.json
  2. +19
    -2
      src/commands/common.ts
  3. +2
    -3
      src/commands/diffWithNext.ts
  4. +2
    -7
      src/commands/diffWithPrevious.ts
  5. +2
    -15
      src/commands/diffWithWorking.ts
  6. +1
    -1
      src/commands/openRevisionFile.ts
  7. +1
    -1
      src/commands/openWorkingFile.ts
  8. +7
    -2
      src/commands/showQuickCommitFile.ts
  9. +6
    -2
      src/commands/toggleFileAnnotations.ts

+ 232
- 35
package.json View File

@ -2409,6 +2409,16 @@
"enablement": "gitlens:activeFileStatus =~ /revision/"
},
{
"command": "gitlens.diffWithNextInDiffRight",
"title": "Open Changes with Next Revision",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-next-commit.svg",
"light": "images/light/icon-next-commit.svg"
},
"enablement": "gitlens:activeFileStatus =~ /revision/"
},
{
"command": "gitlens.diffWithPrevious",
"title": "Open Changes with Previous Revision",
"category": "GitLens",
@ -2418,6 +2428,15 @@
}
},
{
"command": "gitlens.diffWithPreviousInDiffLeft",
"title": "Open Changes with Previous Revision",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-prev-commit.svg",
"light": "images/light/icon-prev-commit.svg"
}
},
{
"command": "gitlens.diffWithPreviousInDiffRight",
"title": "Open Changes with Previous Revision",
"category": "GitLens",
@ -2455,6 +2474,15 @@
}
},
{
"command": "gitlens.diffWithWorkingInDiffLeft",
"title": "Open Changes with Working File",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-compare-ref-working.svg",
"light": "images/light/icon-compare-ref-working.svg"
}
},
{
"command": "gitlens.diffWithWorkingInDiffRight",
"title": "Open Changes with Working File",
"category": "GitLens",
@ -2478,6 +2506,24 @@
}
},
{
"command": "gitlens.toggleFileBlameInDiffLeft",
"title": "Toggle File Blame Annotations",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-git.svg",
"light": "images/light/icon-git.svg"
}
},
{
"command": "gitlens.toggleFileBlameInDiffRight",
"title": "Toggle File Blame Annotations",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-git.svg",
"light": "images/light/icon-git.svg"
}
},
{
"command": "gitlens.clearFileAnnotations",
"title": "Clear File Annotations",
"category": "GitLens",
@ -2505,6 +2551,24 @@
}
},
{
"command": "gitlens.toggleFileHeatmapInDiffLeft",
"title": "Toggle File Heatmap Annotations",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-git.svg",
"light": "images/light/icon-git.svg"
}
},
{
"command": "gitlens.toggleFileHeatmapInDiffRight",
"title": "Toggle File Heatmap Annotations",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-git.svg",
"light": "images/light/icon-git.svg"
}
},
{
"command": "gitlens.toggleFileChanges",
"title": "Toggle File Changes Annotations",
"category": "GitLens",
@ -2600,6 +2664,26 @@
"enablement": "gitlens:activeFileStatus =~ /revision/ && resourceScheme != git"
},
{
"command": "gitlens.showQuickRevisionDetailsInDiffLeft",
"title": "Show Revision Details",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-commit-horizontal.svg",
"light": "images/light/icon-commit-horizontal.svg"
},
"enablement": "gitlens:activeFileStatus =~ /revision/ && resourceScheme != git"
},
{
"command": "gitlens.showQuickRevisionDetailsInDiffRight",
"title": "Show Revision Details",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-commit-horizontal.svg",
"light": "images/light/icon-commit-horizontal.svg"
},
"enablement": "gitlens:activeFileStatus =~ /revision/ && resourceScheme != git"
},
{
"command": "gitlens.showQuickFileHistory",
"title": "Show File History",
"category": "GitLens"
@ -2785,12 +2869,44 @@
"enablement": "gitlens:activeFileStatus =~ /revision/ && resourceScheme != git"
},
{
"command": "gitlens.openRevisionFileInDiffLeft",
"title": "Open File at Revision",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-open-revision.svg",
"light": "images/light/icon-open-revision.svg"
},
"enablement": "gitlens:activeFileStatus =~ /revision/ && resourceScheme != git"
},
{
"command": "gitlens.openRevisionFileInDiffRight",
"title": "Open File at Revision",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-open-revision.svg",
"light": "images/light/icon-open-revision.svg"
},
"enablement": "gitlens:activeFileStatus =~ /revision/ && resourceScheme != git"
},
{
"command": "gitlens.openWorkingFile",
"title": "Open File",
"category": "GitLens",
"icon": "$(go-to-file)"
},
{
"command": "gitlens.openWorkingFileInDiffLeft",
"title": "Open File",
"category": "GitLens",
"icon": "$(go-to-file)"
},
{
"command": "gitlens.openWorkingFileInDiffRight",
"title": "Open File",
"category": "GitLens",
"icon": "$(go-to-file)"
},
{
"command": "gitlens.stashApply",
"title": "Apply Stash",
"category": "GitLens",
@ -4075,20 +4191,20 @@
"when": "gitlens:activeFileStatus =~ /revision/ && !isInDiffEditor"
},
{
"command": "gitlens.diffWithNext",
"when": "gitlens:activeFileStatus =~ /revision/ && isInDiffRightEditor"
"command": "gitlens.diffWithNextInDiffLeft",
"when": "gitlens:activeFileStatus =~ /revision/ && isInDiffEditor && !isInDiffRightEditor"
},
{
"command": "gitlens.diffWithNextInDiffLeft",
"when": "gitlens:activeFileStatus =~ /revision/ && isInDiffLeftEditor"
"command": "gitlens.diffWithNextInDiffRight",
"when": "gitlens:activeFileStatus =~ /revision/ && isInDiffRightEditor"
},
{
"command": "gitlens.diffWithPrevious",
"when": "gitlens:activeFileStatus =~ /tracked/ && !isInDiffEditor"
},
{
"command": "gitlens.diffWithPrevious",
"when": "gitlens:activeFileStatus =~ /tracked/ && isInDiffLeftEditor"
"command": "gitlens.diffWithPreviousInDiffLeft",
"when": "gitlens:activeFileStatus =~ /tracked/ && isInDiffEditor && !isInDiffRightEditor"
},
{
"command": "gitlens.diffWithPreviousInDiffRight",
@ -4104,11 +4220,15 @@
},
{
"command": "gitlens.diffWithWorking",
"when": "gitlens:activeFileStatus =~ /revision/ && !isInDiffEditor"
"when": "gitlens:activeFileStatus =~ /revision/"
},
{
"command": "gitlens.diffWithWorkingInDiffLeft",
"when": "false"
},
{
"command": "gitlens.diffWithWorkingInDiffRight",
"when": "gitlens:activeFileStatus =~ /revision/ && isInDiffRightEditor"
"when": "false"
},
{
"command": "gitlens.diffLineWithWorking",
@ -4127,6 +4247,14 @@
"when": "gitlens:activeFileStatus =~ /blameable/"
},
{
"command": "gitlens.toggleFileBlameInDiffLeft",
"when": "false"
},
{
"command": "gitlens.toggleFileBlameInDiffRight",
"when": "false"
},
{
"command": "gitlens.clearFileAnnotations",
"when": "gitlens:activeFileStatus =~ /blameable/ && gitlens:annotationStatus == computed"
},
@ -4139,8 +4267,16 @@
"when": "gitlens:activeFileStatus =~ /blameable/"
},
{
"command": "gitlens.toggleFileHeatmapInDiffLeft",
"when": "false"
},
{
"command": "gitlens.toggleFileHeatmapInDiffRight",
"when": "false"
},
{
"command": "gitlens.toggleFileChanges",
"when": "gitlens:activeFileStatus =~ /blameable/"
"when": "gitlens:activeFileStatus =~ /blameable/ && !isInDiffEditor"
},
{
"command": "gitlens.toggleLineBlame",
@ -4203,6 +4339,14 @@
"when": "gitlens:activeFileStatus =~ /revision/"
},
{
"command": "gitlens.showQuickRevisionDetailsInDiffLeft",
"when": "false"
},
{
"command": "gitlens.showQuickRevisionDetailsInDiffRight",
"when": "false"
},
{
"command": "gitlens.showQuickFileHistory",
"when": "gitlens:activeFileStatus =~ /tracked/"
},
@ -4299,10 +4443,26 @@
"when": "gitlens:activeFileStatus =~ /revision/ && isInDiffEditor"
},
{
"command": "gitlens.openRevisionFileInDiffLeft",
"when": "false"
},
{
"command": "gitlens.openRevisionFileInDiffRight",
"when": "false"
},
{
"command": "gitlens.openWorkingFile",
"when": "gitlens:activeFileStatus =~ /revision/"
},
{
"command": "gitlens.openWorkingFileInDiffLeft",
"when": "false"
},
{
"command": "gitlens.openWorkingFileInDiffRight",
"when": "false"
},
{
"command": "gitlens.stashApply",
"when": "gitlens:enabled && !gitlens:readonly"
},
@ -5150,8 +5310,8 @@
"group": "navigation@-99"
},
{
"command": "gitlens.diffWithWorking",
"when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme =~ /^(?!(file|git)$).*$/ && isInDiffLeftEditor",
"command": "gitlens.diffWithWorkingInDiffLeft",
"when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme =~ /^(?!(file|git)$).*$/ && isInDiffEditor && !isInDiffRightEditor",
"group": "navigation@-99"
},
{
@ -5161,17 +5321,32 @@
},
{
"command": "gitlens.openWorkingFile",
"when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme =~ /^(?!(file|git)$).*$/",
"when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme == git && !isInDiffEditor",
"group": "navigation@-98"
},
{
"command": "gitlens.openWorkingFile",
"when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme == git && !isInDiffEditor",
"when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme =~ /^(?!(file|git)$).*$/ && !isInDiffEditor",
"group": "navigation@-98"
},
{
"command": "gitlens.openRevisionFile",
"when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme =~ /^(?!(file|git)$).*$/ && isInDiffEditor",
"command": "gitlens.openWorkingFileInDiffLeft",
"when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme =~ /^(?!(file|git)$).*$/ && isInDiffEditor && !isInDiffRightEditor",
"group": "navigation@-98"
},
{
"command": "gitlens.openWorkingFileInDiffRight",
"when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme =~ /^(?!(file|git)$).*$/ && isInDiffRightEditor",
"group": "navigation@-98"
},
{
"command": "gitlens.openRevisionFileInDiffLeft",
"when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme =~ /^(?!(file|git)$).*$/ && isInDiffEditor && !isInDiffRightEditor",
"group": "navigation@-97"
},
{
"command": "gitlens.openRevisionFileInDiffRight",
"when": "gitlens:activeFileStatus =~ /revision/ && resourceScheme =~ /^(?!(file|git)$).*$/ && isInDiffRightEditor",
"group": "navigation@-97"
},
{
@ -5181,9 +5356,9 @@
"group": "navigation@97"
},
{
"command": "gitlens.diffWithPrevious",
"command": "gitlens.diffWithPreviousInDiffLeft",
"alt": "gitlens.diffWithRevision",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare && isInDiffLeftEditor",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare && isInDiffEditor && !isInDiffRightEditor",
"group": "navigation@97"
},
{
@ -5194,7 +5369,17 @@
},
{
"command": "gitlens.showQuickRevisionDetails",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare && !isInDiffEditor",
"group": "navigation@98"
},
{
"command": "gitlens.showQuickRevisionDetailsInDiffLeft",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare && isInDiffEditor && !isInDiffRightEditor",
"group": "navigation@98"
},
{
"command": "gitlens.showQuickRevisionDetailsInDiffRight",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare && isInDiffRightEditor",
"group": "navigation@98"
},
{
@ -5203,19 +5388,31 @@
"group": "navigation@99"
},
{
"command": "gitlens.diffWithNext",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare && isInDiffRightEditor",
"command": "gitlens.diffWithNextInDiffLeft",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare && isInDiffEditor && !isInDiffRightEditor",
"group": "navigation@99"
},
{
"command": "gitlens.diffWithNextInDiffLeft",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare && isInDiffLeftEditor",
"command": "gitlens.diffWithNextInDiffRight",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editorGroup.compare && isInDiffRightEditor",
"group": "navigation@99"
},
{
"command": "gitlens.toggleFileBlame",
"alt": "gitlens.toggleFileHeatmap",
"when": "gitlens:activeFileStatus =~ /blameable/ && !gitlens:annotationStatus && config.gitlens.menus.editorGroup.blame",
"when": "gitlens:activeFileStatus =~ /blameable/ && !gitlens:annotationStatus && config.gitlens.menus.editorGroup.blame && !isInDiffEditor",
"group": "navigation@100"
},
{
"command": "gitlens.toggleFileBlameInDiffLeft",
"alt": "gitlens.toggleFileHeatmapInDiffLeft",
"when": "gitlens:activeFileStatus =~ /blameable/ && !gitlens:annotationStatus && config.gitlens.menus.editorGroup.blame && isInDiffEditor && !isInDiffRightEditor",
"group": "navigation@100"
},
{
"command": "gitlens.toggleFileBlameInDiffRight",
"alt": "gitlens.toggleFileHeatmapInDiffRight",
"when": "gitlens:activeFileStatus =~ /blameable/ && !gitlens:annotationStatus && config.gitlens.menus.editorGroup.blame && isInDiffRightEditor",
"group": "navigation@100"
},
{
@ -7024,14 +7221,14 @@
"when": "config.gitlens.keymap == alternate && editorTextFocus && gitlens:activeFileStatus =~ /revision/ && !isInDiffEditor"
},
{
"command": "gitlens.diffWithNext",
"command": "gitlens.diffWithNextInDiffLeft",
"key": "alt+.",
"when": "config.gitlens.keymap == alternate && editorTextFocus && gitlens:activeFileStatus =~ /revision/ && isInDiffRightEditor"
"when": "config.gitlens.keymap == alternate && editorTextFocus && gitlens:activeFileStatus =~ /revision/ && isInDiffEditor && !isInDiffRightEditor"
},
{
"command": "gitlens.diffWithNextInDiffLeft",
"command": "gitlens.diffWithNextInDiffRight",
"key": "alt+.",
"when": "config.gitlens.keymap == alternate && editorTextFocus && gitlens:activeFileStatus =~ /revision/ && isInDiffLeftEditor"
"when": "config.gitlens.keymap == alternate && editorTextFocus && gitlens:activeFileStatus =~ /revision/ && isInDiffRightEditor"
},
{
"command": "gitlens.diffWithPrevious",
@ -7039,9 +7236,9 @@
"when": "config.gitlens.keymap == alternate && editorTextFocus && gitlens:activeFileStatus =~ /tracked/ && !isInDiffEditor"
},
{
"command": "gitlens.diffWithPrevious",
"command": "gitlens.diffWithPreviousInDiffLeft",
"key": "alt+,",
"when": "config.gitlens.keymap == alternate && editorTextFocus && gitlens:activeFileStatus =~ /tracked/ && isInDiffLeftEditor"
"when": "config.gitlens.keymap == alternate && editorTextFocus && gitlens:activeFileStatus =~ /tracked/ && isInDiffEditor && !isInDiffRightEditor"
},
{
"command": "gitlens.diffWithPreviousInDiffRight",
@ -7118,16 +7315,16 @@
"when": "config.gitlens.keymap == chorded && editorTextFocus && gitlens:activeFileStatus =~ /revision/ && !isInDiffEditor"
},
{
"command": "gitlens.diffWithNext",
"command": "gitlens.diffWithNextInDiffLeft",
"key": "ctrl+shift+g .",
"mac": "cmd+alt+g .",
"when": "config.gitlens.keymap == chorded && editorTextFocus && gitlens:activeFileStatus =~ /revision/ && isInDiffRightEditor"
"when": "config.gitlens.keymap == chorded && editorTextFocus && gitlens:activeFileStatus =~ /revision/ && isInDiffEditor && !isInDiffRightEditor"
},
{
"command": "gitlens.diffWithNextInDiffLeft",
"command": "gitlens.diffWithNextInDiffRight",
"key": "ctrl+shift+g .",
"mac": "cmd+alt+g .",
"when": "config.gitlens.keymap == chorded && editorTextFocus && gitlens:activeFileStatus =~ /revision/ && isInDiffLeftEditor"
"when": "config.gitlens.keymap == chorded && editorTextFocus && gitlens:activeFileStatus =~ /revision/ && isInDiffRightEditor"
},
{
"command": "gitlens.diffWithPrevious",
@ -7136,10 +7333,10 @@
"when": "config.gitlens.keymap == chorded && editorTextFocus && gitlens:activeFileStatus =~ /tracked/ && !isInDiffEditor"
},
{
"command": "gitlens.diffWithPrevious",
"command": "gitlens.diffWithPreviousInDiffLeft",
"key": "ctrl+shift+g ,",
"mac": "cmd+alt+g ,",
"when": "config.gitlens.keymap == chorded && editorTextFocus && gitlens:activeFileStatus =~ /tracked/ && isInDiffLeftEditor"
"when": "config.gitlens.keymap == chorded && editorTextFocus && gitlens:activeFileStatus =~ /tracked/ && isInDiffEditor && !isInDiffRightEditor"
},
{
"command": "gitlens.diffWithPreviousInDiffRight",

+ 19
- 2
src/commands/common.ts View File

@ -45,12 +45,15 @@ export enum Commands {
DiffWith = 'gitlens.diffWith',
DiffWithNext = 'gitlens.diffWithNext',
DiffWithNextInDiffLeft = 'gitlens.diffWithNextInDiffLeft',
DiffWithNextInDiffRight = 'gitlens.diffWithNextInDiffRight',
DiffWithPrevious = 'gitlens.diffWithPrevious',
DiffWithPreviousInDiffLeft = 'gitlens.diffWithPreviousInDiffLeft',
DiffWithPreviousInDiffRight = 'gitlens.diffWithPreviousInDiffRight',
DiffLineWithPrevious = 'gitlens.diffLineWithPrevious',
DiffWithRevision = 'gitlens.diffWithRevision',
DiffWithRevisionFrom = 'gitlens.diffWithRevisionFrom',
DiffWithWorking = 'gitlens.diffWithWorking',
DiffWithWorkingInDiffLeft = 'gitlens.diffWithWorkingInDiffLeft',
DiffWithWorkingInDiffRight = 'gitlens.diffWithWorkingInDiffRight',
DiffLineWithWorking = 'gitlens.diffLineWithWorking',
DisconnectRemoteProvider = 'gitlens.disconnectRemoteProvider',
@ -69,7 +72,11 @@ export enum Commands {
OpenInRemote = 'gitlens.openInRemote',
OpenRepoInRemote = 'gitlens.openRepoInRemote',
OpenRevisionFile = 'gitlens.openRevisionFile',
OpenRevisionFileInDiffLeft = 'gitlens.openRevisionFileInDiffLeft',
OpenRevisionFileInDiffRight = 'gitlens.openRevisionFileInDiffRight',
OpenWorkingFile = 'gitlens.openWorkingFile',
OpenWorkingFileInDiffLeft = 'gitlens.openWorkingFileInDiffLeft',
OpenWorkingFileInDiffRight = 'gitlens.openWorkingFileInDiffRight',
PullRepositories = 'gitlens.pullRepositories',
PushRepositories = 'gitlens.pushRepositories',
GitCommands = 'gitlens.gitCommands',
@ -92,6 +99,8 @@ export enum Commands {
ShowQuickFileHistory = 'gitlens.showQuickFileHistory',
ShowQuickRepoStatus = 'gitlens.showQuickRepoStatus',
ShowQuickCommitRevision = 'gitlens.showQuickRevisionDetails',
ShowQuickCommitRevisionInDiffLeft = 'gitlens.showQuickRevisionDetailsInDiffLeft',
ShowQuickCommitRevisionInDiffRight = 'gitlens.showQuickRevisionDetailsInDiffRight',
ShowQuickStashList = 'gitlens.showQuickStashList',
ShowRepositoriesView = 'gitlens.showRepositoriesView',
ShowSearchView = 'gitlens.showSearchView',
@ -116,8 +125,12 @@ export enum Commands {
SwitchMode = 'gitlens.switchMode',
ToggleCodeLens = 'gitlens.toggleCodeLens',
ToggleFileBlame = 'gitlens.toggleFileBlame',
ToggleFileBlameInDiffLeft = 'gitlens.toggleFileBlameInDiffLeft',
ToggleFileBlameInDiffRight = 'gitlens.toggleFileBlameInDiffRight',
ToggleFileChanges = 'gitlens.toggleFileChanges',
ToggleFileHeatmap = 'gitlens.toggleFileHeatmap',
ToggleFileHeatmapInDiffLeft = 'gitlens.toggleFileHeatmapInDiffLeft',
ToggleFileHeatmapInDiffRight = 'gitlens.toggleFileHeatmapInDiffRight',
ToggleLineBlame = 'gitlens.toggleLineBlame',
ToggleReviewMode = 'gitlens.toggleReviewMode',
ToggleZenMode = 'gitlens.toggleZenMode',
@ -399,8 +412,12 @@ export abstract class Command implements Disposable {
if (args.length > 0 && (firstArg == null || firstArg instanceof Uri)) {
const [uri, ...rest] = args as [Uri, any];
if (uri != null) {
// If the uri matches the active editor, then pass the active editor
if (editor == null && uri.toString() === window.activeTextEditor?.document.uri.toString()) {
// If the uri matches the active editor (or we are in a left-hand side of a diff), then pass the active editor
if (
editor == null &&
(uri.toString() === window.activeTextEditor?.document.uri.toString() ||
command.endsWith('InDiffLeft'))
) {
editor = window.activeTextEditor;
}

+ 2
- 3
src/commands/diffWithNext.ts View File

@ -20,13 +20,12 @@ export interface DiffWithNextCommandArgs {
@command()
export class DiffWithNextCommand extends ActiveEditorCommand {
constructor() {
super([Commands.DiffWithNext, Commands.DiffWithNextInDiffLeft]);
super([Commands.DiffWithNext, Commands.DiffWithNextInDiffLeft, Commands.DiffWithNextInDiffRight]);
}
protected preExecute(context: CommandContext, args?: DiffWithNextCommandArgs) {
if (context.command === Commands.DiffWithNextInDiffLeft) {
args = { ...args };
args.inDiffLeftEditor = true;
args = { ...args, inDiffLeftEditor: true };
}
return this.execute(context.editor, context.uri, args);

+ 2
- 7
src/commands/diffWithPrevious.ts View File

@ -28,17 +28,12 @@ export interface DiffWithPreviousCommandArgs {
@command()
export class DiffWithPreviousCommand extends ActiveEditorCommand {
constructor() {
super([Commands.DiffWithPrevious, Commands.DiffWithPreviousInDiffRight]);
super([Commands.DiffWithPrevious, Commands.DiffWithPreviousInDiffLeft, Commands.DiffWithPreviousInDiffRight]);
}
protected preExecute(context: CommandContext, args?: DiffWithPreviousCommandArgs) {
if (context.command === Commands.DiffWithPreviousInDiffRight) {
args = { ...args };
// Ensure we are on the right side -- context.uri is always the right-side uri, so ensure the editor matches, otherwise we are on the left
if (context.editor == null || context.editor?.document.uri.toString() === context.uri?.toString()) {
args.inDiffRightEditor = true;
}
args = { ...args, inDiffRightEditor: true };
}
return this.execute(context.editor, context.uri, args);

+ 2
- 15
src/commands/diffWithWorking.ts View File

@ -1,6 +1,6 @@
'use strict';
import { TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, command, CommandContext, Commands, executeCommand, getCommandUri } from './common';
import { ActiveEditorCommand, command, Commands, executeCommand, getCommandUri } from './common';
import { Container } from '../container';
import { DiffWithCommandArgs } from './diffWith';
import { GitRevision } from '../git/git';
@ -18,20 +18,7 @@ export interface DiffWithWorkingCommandArgs {
@command()
export class DiffWithWorkingCommand extends ActiveEditorCommand {
constructor() {
super([Commands.DiffWithWorking, Commands.DiffWithWorkingInDiffRight]);
}
protected preExecute(context: CommandContext, args?: DiffWithWorkingCommandArgs) {
if (context.command === Commands.DiffWithWorkingInDiffRight) {
args = { ...args };
// Ensure we are on the right side -- context.uri is always the right-side uri, so ensure the editor matches, otherwise we are on the left
if (context.editor == null || context.editor?.document.uri.toString() === context.uri?.toString()) {
args.inDiffRightEditor = true;
}
}
return this.execute(context.editor, context.uri, args);
super([Commands.DiffWithWorking, Commands.DiffWithWorkingInDiffLeft, Commands.DiffWithWorkingInDiffRight]);
}
async execute(editor?: TextEditor, uri?: Uri, args?: DiffWithWorkingCommandArgs): Promise<any> {

+ 1
- 1
src/commands/openRevisionFile.ts View File

@ -19,7 +19,7 @@ export interface OpenRevisionFileCommandArgs {
@command()
export class OpenRevisionFileCommand extends ActiveEditorCommand {
constructor() {
super(Commands.OpenRevisionFile);
super([Commands.OpenRevisionFile, Commands.OpenRevisionFileInDiffLeft, Commands.OpenRevisionFileInDiffRight]);
}
async execute(editor?: TextEditor, uri?: Uri, args?: OpenRevisionFileCommandArgs) {

+ 1
- 1
src/commands/openWorkingFile.ts View File

@ -17,7 +17,7 @@ export interface OpenWorkingFileCommandArgs {
@command()
export class OpenWorkingFileCommand extends ActiveEditorCommand {
constructor() {
super(Commands.OpenWorkingFile);
super([Commands.OpenWorkingFile, Commands.OpenWorkingFileInDiffLeft, Commands.OpenWorkingFileInDiffRight]);
}
async execute(editor: TextEditor, uri?: Uri, args?: OpenWorkingFileCommandArgs) {

+ 7
- 2
src/commands/showQuickCommitFile.ts View File

@ -29,11 +29,16 @@ export class ShowQuickCommitFileCommand extends ActiveEditorCachedCommand {
}
constructor() {
super([Commands.ShowQuickCommitFile, Commands.ShowQuickCommitRevision]);
super([
Commands.ShowQuickCommitFile,
Commands.ShowQuickCommitRevision,
Commands.ShowQuickCommitRevisionInDiffLeft,
Commands.ShowQuickCommitRevisionInDiffRight,
]);
}
protected async preExecute(context: CommandContext, args?: ShowQuickCommitFileCommandArgs) {
if (context.command === Commands.ShowQuickCommitRevision && context.editor !== undefined) {
if (context.editor != null && context.command.startsWith(Commands.ShowQuickCommitRevision)) {
args = { ...args };
const gitUri = await GitUri.fromUri(context.editor.document.uri);

+ 6
- 2
src/commands/toggleFileAnnotations.ts View File

@ -43,7 +43,7 @@ export interface ToggleFileAnnotationCommandArgs {
@command()
export class ToggleFileBlameCommand extends ActiveEditorCommand {
constructor() {
super(Commands.ToggleFileBlame);
super([Commands.ToggleFileBlame, Commands.ToggleFileBlameInDiffLeft, Commands.ToggleFileBlameInDiffRight]);
}
execute(editor: TextEditor, uri?: Uri, args?: ToggleFileAnnotationCommandArgs): Promise<void> {
@ -71,7 +71,11 @@ export class ToggleFileChangesCommand extends ActiveEditorCommand {
@command()
export class ToggleFileHeatmapCommand extends ActiveEditorCommand {
constructor() {
super(Commands.ToggleFileHeatmap);
super([
Commands.ToggleFileHeatmap,
Commands.ToggleFileHeatmapInDiffLeft,
Commands.ToggleFileHeatmapInDiffRight,
]);
}
execute(editor: TextEditor, uri?: Uri, args?: ToggleFileAnnotationCommandArgs): Promise<void> {

Loading…
Cancel
Save