Skip to content

Commit d5d3789

Browse files
Copilotalexr00
andauthored
Add "Reveal in File Explorer" context menu option for local PR files (#8284)
* Initial plan * Initial plan for adding Reveal in Explorer feature Co-authored-by: alexr00 <[email protected]> * Add Reveal in File Explorer command for PR files Co-authored-by: alexr00 <[email protected]> * Refactor: Extract _appendLocalSuffix helper method Co-authored-by: alexr00 <[email protected]> * Fix: Prevent duplicate :local suffix in contextValue Co-authored-by: alexr00 <[email protected]> * Fix when --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: alexr00 <[email protected]>
1 parent 34ae85d commit d5d3789

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

package.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,11 @@
10641064
"title": "%command.pr.openFileOnGitHub.title%",
10651065
"category": "%command.pull.request.category%"
10661066
},
1067+
{
1068+
"command": "pr.revealFileInOS",
1069+
"title": "%command.pr.revealFileInOS.title%",
1070+
"category": "%command.pull.request.category%"
1071+
},
10671072
{
10681073
"command": "pr.copyCommitHash",
10691074
"title": "%command.pr.copyCommitHash.title%",
@@ -2164,6 +2169,10 @@
21642169
"command": "pr.openFileOnGitHub",
21652170
"when": "false"
21662171
},
2172+
{
2173+
"command": "pr.revealFileInOS",
2174+
"when": "false"
2175+
},
21672176
{
21682177
"command": "pr.openOriginalFile",
21692178
"when": "false"
@@ -3014,15 +3023,20 @@
30143023
"when": "view =~ /(pr|prStatus):github/ && viewItem =~ /filechange/",
30153024
"group": "0_open@0"
30163025
},
3026+
{
3027+
"command": "pr.revealFileInOS",
3028+
"when": "view =~ /(pr|prStatus):github/ && viewItem =~ /filechange(?!:ADD)/",
3029+
"group": "0_open@1"
3030+
},
30173031
{
30183032
"command": "pr.openOriginalFile",
30193033
"when": "view =~ /(pr|prStatus):github/ && viewItem =~ /filechange:MODIFY/",
3020-
"group": "0_open@1"
3034+
"group": "0_open@2"
30213035
},
30223036
{
30233037
"command": "pr.openModifiedFile",
30243038
"when": "view =~ /(pr|prStatus):github/ && viewItem =~ /filechange:MODIFY/",
3025-
"group": "0_open@2"
3039+
"group": "0_open@3"
30263040
},
30273041
{
30283042
"command": "review.diffWithPrHead",

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
"command.pr.openAllDiffs.title": "Open All Diffs",
212212
"command.pr.refreshPullRequest.title": "Refresh Pull Request",
213213
"command.pr.openFileOnGitHub.title": "Open File on GitHub",
214+
"command.pr.revealFileInOS.title": "Reveal in File Explorer",
214215
"command.pr.copyCommitHash.title": "Copy Commit Hash",
215216
"command.pr.openOriginalFile.title": "Open Original File",
216217
"command.pr.openModifiedFile.title": "Open Modified File",

src/commands.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,16 @@ export function registerCommands(
232232
}),
233233
);
234234

235+
context.subscriptions.push(
236+
vscode.commands.registerCommand('pr.revealFileInOS', (e: GitFileChangeNode) => {
237+
const folderManager = reposManager.getManagerForIssueModel(e.pullRequest);
238+
if (folderManager) {
239+
const filePath = vscode.Uri.joinPath(folderManager.repository.rootUri, e.changeModel.fileName);
240+
vscode.commands.executeCommand('revealFileInOS', filePath);
241+
}
242+
}),
243+
);
244+
235245
context.subscriptions.push(
236246
vscode.commands.registerCommand('pr.openOriginalFile', async (e: GitFileChangeNode) => {
237247
// if this is an image, encode it as a base64 data URI

0 commit comments

Comments
 (0)