Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 3d15385

Browse files
committed
feat: open pull request of current branch
Closes #91
1 parent 77b94ab commit 3d15385

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@
8080
"title": "Checkout open pull request...",
8181
"category": "GitHub"
8282
},
83+
{
84+
"command": "vscode-github.browserSimplePullRequest",
85+
"title": "Browse pull request of current branch",
86+
"category": "GitHub"
87+
},
8388
{
8489
"command": "vscode-github.browserPullRequest",
8590
"title": "Browse open pull request...",

src/extension.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ class Extension {
4343
vscode.commands.registerCommand('vscode-github.createPullRequest', this.wrapCommand(this.createPullRequest)),
4444
vscode.commands.registerCommand('vscode-github.checkoutPullRequests',
4545
this.wrapCommand(this.checkoutPullRequests)),
46-
vscode.commands.registerCommand('vscode-github.browserPullRequest', this.wrapCommand(this.browserPullRequest)),
46+
vscode.commands.registerCommand('vscode-github.browserSimplePullRequest',
47+
this.wrapCommand(this.browseSimplePullRequest)),
48+
vscode.commands.registerCommand('vscode-github.browserPullRequest', this.wrapCommand(this.browsePullRequest)),
4749
vscode.commands.registerCommand('vscode-github.mergePullRequest', this.wrapCommand(this.mergePullRequest)),
4850
vscode.commands.registerCommand('vscode-github.addAssignee', this.wrapCommand(this.addAssignee)),
4951
vscode.commands.registerCommand('vscode-github.removeAssignee', this.wrapCommand(this.removeAssignee)),
@@ -231,7 +233,18 @@ class Extension {
231233
});
232234
}
233235

234-
private async browserPullRequest(): Promise<void> {
236+
private async browseSimplePullRequest(): Promise<void> {
237+
await this.withinProgressUI(async() => {
238+
const pullRequest = await this.githubManager.getPullRequestForCurrentBranch();
239+
if (pullRequest) {
240+
await vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(pullRequest.html_url));
241+
} else {
242+
vscode.window.showInformationMessage('No pull request for current branch found');
243+
}
244+
});
245+
}
246+
247+
private async browsePullRequest(): Promise<void> {
235248
this.selectPullRequest(pullRequest => {
236249
vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(pullRequest.html_url));
237250
});

0 commit comments

Comments
 (0)