Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 23 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@
"id": "github-pull-requests",
"title": "GitHub",
"icon": "resources/icons/dark/github.svg"
},
{
"id": "github-pull-request",
"title": "GitHub Pull Request",
"icon": "resources/icons/pull-request.png"
}
]
},
Expand All @@ -376,31 +381,20 @@
"when": "ReposManagerStateContext == NeedsAuthentication",
"icon": "resources/icons/pull-request.png"
},
{
"id": "prStatus:github",
"name": "Changes In Pull Request",
"when": "github:inReviewMode",
"icon": "resources/icons/pull-request.png",
"visibility": "visible"
},
{
"id": "pr:github",
"name": "Pull Requests",
"when": "ReposManagerStateContext != NeedsAuthentication && !github:focusedReview && !github:createPullRequest",
"when": "ReposManagerStateContext != NeedsAuthentication",
"icon": "resources/icons/pull-request.png"
},
{
"id": "github:activePullRequest",
"type": "webview",
"name": "Active Pull Request",
"when": "github:focusedReview"
},
{
"id": "issues:github",
"name": "Issues",
"when": "ReposManagerStateContext != NeedsAuthentication && !github:focusedReview &&!github:createPullRequest",
"when": "ReposManagerStateContext != NeedsAuthentication",
"icon": "resources/icons/issues.png"
},
}
],
"github-pull-request": [
{
"id": "github:createPullRequest",
"type": "webview",
Expand All @@ -413,6 +407,19 @@
"name": "Compare Changes",
"when": "github:createPullRequest",
"visibility": "visible"
},
{
"id": "prStatus:github",
"name": "Changes In Pull Request",
"when": "github:inReviewMode",
"icon": "resources/icons/pull-request.png",
"visibility": "visible"
},
{
"id": "github:activePullRequest",
"type": "webview",
"name": "Active Pull Request",
"when": "github:focusedReview"
}
]
},
Expand Down
6 changes: 5 additions & 1 deletion src/view/prChangesTreeDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class PullRequestChangesTreeDataProvider extends vscode.Disposable implem
this._view.title = pullRequestNumber ? `Changes in Pull Request #${pullRequestNumber}` : 'Changes in Pull Request';
}

async addPrToView(pullRequestManager: FolderRepositoryManager, pullRequest: PullRequestModel, localFileChanges: (GitFileChangeNode | RemoteFileChangeNode)[], comments: IComment[]) {
async addPrToView(pullRequestManager: FolderRepositoryManager, pullRequest: PullRequestModel, localFileChanges: (GitFileChangeNode | RemoteFileChangeNode)[], comments: IComment[], shouldReveal: boolean) {
const node: RepositoryChangesNode = new RepositoryChangesNode(this._view, pullRequest, pullRequestManager, comments, localFileChanges);
this._pullRequestManagerMap.set(pullRequestManager, node);
this.updateViewTitle();
Expand All @@ -69,6 +69,10 @@ export class PullRequestChangesTreeDataProvider extends vscode.Disposable implem
true
);
this._onDidChangeTreeData.fire();

if (shouldReveal) {
this._view.reveal(node);
}
}

async removePrFromView(pullRequestManager: FolderRepositoryManager) {
Expand Down
11 changes: 10 additions & 1 deletion src/view/reviewManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ export class ReviewManager {

private _switchingToReviewMode: boolean;

/**
* Flag set when the "Checkout" action is used and cleared on the next git
* state update, once review mode has been entered. Used to disambiguate
* explicit user action from something like reloading on an existing PR branch.
*/
private justSwitchedToRevieMode: boolean = false;

public get switchingToReviewMode(): boolean {
return this._switchingToReviewMode;
}
Expand Down Expand Up @@ -275,7 +282,8 @@ export class ReviewManager {

Logger.appendLine('Review> Fetching pull request data');
await this.getPullRequestData(pr);
await this.changesInPrDataProvider.addPrToView(this._folderRepoManager, pr, this._localFileChanges, this._comments);
await this.changesInPrDataProvider.addPrToView(this._folderRepoManager, pr, this._localFileChanges, this._comments, this.justSwitchedToRevieMode);
this.justSwitchedToRevieMode = false;

Logger.appendLine(`Review> register comments provider`);
await this.registerCommentController();
Expand Down Expand Up @@ -514,6 +522,7 @@ export class ReviewManager {
Logger.appendLine(`Review> switch to Pull Request #${pr.number} - done`, ReviewManager.ID);
} finally {
this.switchingToReviewMode = false;
this.justSwitchedToRevieMode = true;
this.statusBarItem.text = `Pull Request #${pr.number}`;
this.statusBarItem.command = undefined;
this.statusBarItem.show();
Expand Down