From 9aa876f8cc4fcd06baf3ac01afbd4a22cf7604ea Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 8 Oct 2026 10:19:51 +0000 Subject: [PATCH 1/3] Initial plan From 71043fbc24044a9eb81c4dbe30975a4a6fd22ba5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 8 Oct 2026 10:29:10 +0000 Subject: [PATCH 2/3] Fix context menu actions for deleted PR files Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> --- package.json | 4 +-- src/test/view/fileChangeMenus.test.ts | 42 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 src/test/view/fileChangeMenus.test.ts diff --git a/package.json b/package.json index 82c9643579..4ac8eb05b9 100644 --- a/package.json +++ b/package.json @@ -3147,12 +3147,12 @@ }, { "command": "pr.revealFileInOS", - "when": "(view =~ /(pr|prStatus):github/ && viewItem =~ /filechange(?!:ADD)/) && !isSessionsWindow", + "when": "(view =~ /(pr|prStatus):github/ && viewItem =~ /filechange(?!:(ADD|DELETE))/) && !isSessionsWindow", "group": "0_open@1" }, { "command": "pr.openOriginalFile", - "when": "(view =~ /(pr|prStatus):github/ && viewItem =~ /filechange:MODIFY/) && !isSessionsWindow", + "when": "(view =~ /(pr|prStatus):github/ && viewItem =~ /filechange:(MODIFY|DELETE)/) && !isSessionsWindow", "group": "0_open@2" }, { diff --git a/src/test/view/fileChangeMenus.test.ts b/src/test/view/fileChangeMenus.test.ts new file mode 100644 index 0000000000..a87076ae77 --- /dev/null +++ b/src/test/view/fileChangeMenus.test.ts @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { default as assert } from 'assert'; +import packageJson from '../../../package.json'; + +describe('File change context menus', function () { + const cases = [ + { status: 'ADD', openOriginal: false, reveal: false }, + { status: 'DELETE', openOriginal: true, reveal: false }, + { status: 'MODIFY', openOriginal: true, reveal: true }, + { status: 'RENAME', openOriginal: false, reveal: true }, + { status: 'COPY', openOriginal: false, reveal: true }, + { status: 'TYPE', openOriginal: false, reveal: true }, + { status: 'UNKNOWN', openOriginal: false, reveal: true }, + { status: 'UNMERGED', openOriginal: false, reveal: true }, + ]; + + for (const command of ['pr.openOriginalFile', 'pr.revealFileInOS']) { + it(`shows ${command} only for applicable file changes`, function () { + const menu = packageJson.contributes.menus['view/item/context'].find(item => item.command === command); + assert.ok(menu); + const match = /viewItem =~ \/(?[^/]+)\//.exec(menu.when); + assert.ok(match?.groups?.pattern); + const pattern = new RegExp(match.groups.pattern); + + for (const testCase of cases) { + for (const viewed of ['viewed', 'unviewed']) { + const contextValue = `filechange:${testCase.status}:${viewed}`; + assert.strictEqual( + pattern.test(contextValue), + command === 'pr.openOriginalFile' ? testCase.openOriginal : testCase.reveal, + contextValue, + ); + } + } + assert.strictEqual(pattern.test('description'), false); + }); + } +}); From c47c28cd52e6728e2105b8d0a5e746322028422d Mon Sep 17 00:00:00 2001 From: Alex Ross <38270282+alexr00@users.noreply.github.com> Date: Fri, 9 Oct 2026 17:39:38 +0200 Subject: [PATCH 3/3] Attestation commit