Skip to content

Commit 4366763

Browse files
author
Rachel Macfarlane
committed
Option to refresh a single PR, fixes #212
1 parent 9d0f5e5 commit 4366763

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

package.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@
8282
"title": "Open Pull Request in GitHub",
8383
"category": "GitHub Pull Requests"
8484
},
85+
{
86+
"command": "pr.refreshPullRequest",
87+
"title": "Refresh Pull Request",
88+
"category": "GitHub Pull Requests"
89+
},
8590
{
8691
"command": "pr.openFileInGitHub",
8792
"title": "Open File in GitHub",
@@ -152,6 +157,10 @@
152157
"command": "pr.openFileInGitHub",
153158
"when": "false"
154159
},
160+
{
161+
"command": "pr.refreshPullRequest",
162+
"when": "false"
163+
},
155164
{
156165
"command": "pr.deleteLocalBranch",
157166
"when": "false"
@@ -188,19 +197,24 @@
188197
"group": "pullrequest@1"
189198
},
190199
{
191-
"command": "pr.openPullRequestInGitHub",
200+
"command": "pr.refreshPullRequest",
192201
"when": "view == pr && viewItem =~ /pullrequest/",
193202
"group": "pullrequest@2"
194203
},
195204
{
196-
"command": "pr.close",
205+
"command": "pr.openPullRequestInGitHub",
197206
"when": "view == pr && viewItem =~ /pullrequest/",
198207
"group": "pullrequest@3"
199208
},
209+
{
210+
"command": "pr.close",
211+
"when": "view == pr && viewItem =~ /pullrequest/",
212+
"group": "pullrequest@4"
213+
},
200214
{
201215
"command": "pr.deleteLocalBranch",
202216
"when": "view == pr && viewItem =~ /pullrequest:local:nonactive/",
203-
"group": "pullrequest@4"
217+
"group": "pullrequest@5"
204218
},
205219
{
206220
"command": "pr.openFileInGitHub",

src/view/prsTreeDataProvider.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ export class PullRequestsTreeDataProvider implements vscode.TreeDataProvider<Tre
4444
this._childrenDisposables = [];
4545
}
4646

47+
async refresh(node?: TreeNode) {
48+
return node ? this._onDidChangeTreeData.fire(node) : this._onDidChangeTreeData.fire();
49+
}
50+
4751
getTreeItem(element: TreeNode): vscode.TreeItem {
4852
return element.getTreeItem();
4953
}

src/view/reviewManager.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { FileChangeNode, RemoteFileChangeNode, fileChangeNodeFilter } from './tr
2121
import Logger from '../common/logger';
2222
import { PullRequestsTreeDataProvider } from './prsTreeDataProvider';
2323
import { IConfiguration } from '../authentication/configuration';
24-
import { providePRDocumentComments } from './treeNodes/pullRequestNode';
24+
import { providePRDocumentComments, PRNode } from './treeNodes/pullRequestNode';
2525

2626
export class ReviewManager implements vscode.DecorationProvider {
2727
private static _instance: ReviewManager;
@@ -70,6 +70,14 @@ export class ReviewManager implements vscode.DecorationProvider {
7070
this.prFileChangesProvider.refresh();
7171
}));
7272

73+
this._disposables.push(vscode.commands.registerCommand('pr.refreshPullRequest', (prNode: PRNode) => {
74+
if (prNode.pullRequestModel.equals(this._prManager.activePullRequest)) {
75+
this.updateComments();
76+
}
77+
78+
this._prsTreeDataProvider.refresh(prNode);
79+
}));
80+
7381
this._prsTreeDataProvider = new PullRequestsTreeDataProvider(this._configuration, _repository, _prManager);
7482
this._disposables.push(this._prsTreeDataProvider);
7583
this._disposables.push(vscode.window.registerDecorationProvider(this));

0 commit comments

Comments
 (0)