From 56e2ea2b0e33884b34dad8b6e53ae642559debfa Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 27 Jul 2020 02:02:35 -0400 Subject: [PATCH] Fixes more context menu commands (for real) Caused by c75d5fed27beb73bb172ce63cf50315f0f468d0c --- src/commands/common.ts | 5 +---- src/commands/diffWithPrevious.ts | 2 +- src/commands/diffWithWorking.ts | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/commands/common.ts b/src/commands/common.ts index ebc4bc3..e6099e7 100644 --- a/src/commands/common.ts +++ b/src/commands/common.ts @@ -392,9 +392,6 @@ export abstract class Command implements Disposable { // If the uri matches the active editor, then pass the active editor if (editor == null && uri.toString() === window.activeTextEditor?.document.uri.toString()) { editor = window.activeTextEditor; - } else { - // eslint-disable-next-line no-debugger - debugger; } const uris = rest[0]; @@ -448,7 +445,7 @@ export abstract class Command implements Disposable { return [{ command: command, type: 'scm-groups', scmResourceGroups: groups }, args.slice(count)]; } - return [{ command: command, type: 'unknown', editor: editor }, args]; + return [{ command: command, type: 'unknown', editor: editor, uri: editor?.document.uri }, args]; } } diff --git a/src/commands/diffWithPrevious.ts b/src/commands/diffWithPrevious.ts index 9d8be62..43b36c8 100644 --- a/src/commands/diffWithPrevious.ts +++ b/src/commands/diffWithPrevious.ts @@ -36,7 +36,7 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand { 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?.document.uri.toString() === context.uri?.toString()) { + if (context.editor == null || context.editor?.document.uri.toString() === context.uri?.toString()) { args.inDiffRightEditor = true; } } diff --git a/src/commands/diffWithWorking.ts b/src/commands/diffWithWorking.ts index 3e0066e..02c6737 100644 --- a/src/commands/diffWithWorking.ts +++ b/src/commands/diffWithWorking.ts @@ -26,7 +26,7 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand { 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?.document.uri.toString() === context.uri?.toString()) { + if (context.editor == null || context.editor?.document.uri.toString() === context.uri?.toString()) { args.inDiffRightEditor = true; } }