diff --git a/package.json b/package.json index 6af62c5370..d5472ac0ed 100644 --- a/package.json +++ b/package.json @@ -112,6 +112,16 @@ "title": "Open File in GitHub", "category": "GitHub Pull Requests" }, + { + "command": "pr.openOriginalFile", + "title": "Open Original File", + "category": "GitHub Pull Requests" + }, + { + "command": "pr.openModifiedFile", + "title": "Open Modified File", + "category": "GitHub Pull Requests" + }, { "command": "pr.openDiffView", "title": "Open Diff View", @@ -191,6 +201,14 @@ "command": "pr.openFileInGitHub", "when": "false" }, + { + "command": "pr.openOriginalFile", + "when": "false" + }, + { + "command": "pr.openModifiedFile", + "when": "false" + }, { "command": "pr.refreshPullRequest", "when": "false" @@ -260,6 +278,14 @@ { "command": "pr.openFileInGitHub", "when": "view =~ /(pr|prStatus)/ && viewItem == filechange" + }, + { + "command": "pr.openOriginalFile", + "when": "view =~ /(pr|prStatus)/ && viewItem == filechange" + }, + { + "command": "pr.openModifiedFile", + "when": "view =~ /(pr|prStatus)/ && viewItem == filechange" } ], "editor/title": [ diff --git a/src/commands.ts b/src/commands.ts index 148e448b65..8ce1edc01a 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -55,6 +55,14 @@ export function registerCommands(context: vscode.ExtensionContext, prManager: IP vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(e.blobUrl)); })); + context.subscriptions.push(vscode.commands.registerCommand('pr.openOriginalFile', (e: GitFileChangeNode) => { + vscode.commands.executeCommand('vscode.open', e.parentFilePath); + })); + + context.subscriptions.push(vscode.commands.registerCommand('pr.openModifiedFile', (e: GitFileChangeNode) => { + vscode.commands.executeCommand('vscode.open', e.filePath); + })); + context.subscriptions.push(vscode.commands.registerCommand('pr.openDiffView', (parentFilePath: string, filePath: string, fileName: string, isPartial: boolean, opts: any) => { if (isPartial) { vscode.window.showInformationMessage('Your local repository is not up to date so only partial content is being displayed');