Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display a message before opening file diffs in the browser #575

Merged
merged 2 commits into from
May 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/commands.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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