Skip to content

Commit

Permalink
Display a message before opening file diffs in the browser (#575), fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
malwilley authored and Rachel Macfarlane committed May 23, 2019
1 parent c0ced7c commit 0248f28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/commands.ts
Expand Up @@ -151,6 +151,16 @@ export function registerCommands(context: vscode.ExtensionContext, prManager: Pu
vscode.commands.executeCommand('vscode.diff', parentFilePath, filePath, fileName, opts);
}));

context.subscriptions.push(vscode.commands.registerCommand('pr.openDiffGitHub', (uri: string) => {
vscode.window
.showWarningMessage('This file is either too large, of an unsupported type, or has only been renamed. Would you like to view it on GitHub?', 'Open in GitHub')
.then(result => {
if (result === 'Open in GitHub') {
vscode.commands.executeCommand('vscode.open', uri);
}
});
}));

context.subscriptions.push(vscode.commands.registerCommand('pr.deleteLocalBranch', async (e: PRNode) => {
const pullRequestModel = ensurePR(prManager, e);
const DELETE_BRANCH_FORCE = 'delete branch (even if not merged)';
Expand Down
2 changes: 1 addition & 1 deletion src/view/treeNodes/fileChangeNode.ts
Expand Up @@ -38,7 +38,7 @@ export class RemoteFileChangeNode extends TreeNode implements vscode.TreeItem {

this.command = {
title: 'show remote file',
command: 'vscode.open',
command: 'pr.openDiffGitHub',
arguments: [
vscode.Uri.parse(this.blobUrl)
]
Expand Down

0 comments on commit 0248f28

Please sign in to comment.