Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -191,6 +201,14 @@
"command": "pr.openFileInGitHub",
"when": "false"
},
{
"command": "pr.openOriginalFile",
"when": "false"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the when false do here? The other commands are doing this too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hides it from the command palette. That way it can only be run from the context menu where it's added, so it always has the file as an argument

},
{
"command": "pr.openModifiedFile",
"when": "false"
},
{
"command": "pr.refreshPullRequest",
"when": "false"
Expand Down Expand Up @@ -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": [
Expand Down
8 changes: 8 additions & 0 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down