Skip to content

Commit 611073f

Browse files
authored
Open overview when there are no diffs on checkout (#7125)
Fixes microsoft/vscode-copilot#18911
1 parent a9a864e commit 611073f

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,12 @@
707707
"multiDiff",
708708
false
709709
],
710+
"enumDescriptions": [
711+
"%githubPullRequests.focusedMode.firstDiff%",
712+
"%githubPullRequests.focusedMode.overview%",
713+
"%githubPullRequests.focusedMode.multiDiff%",
714+
"%githubPullRequests.focusedMode.false%"
715+
],
710716
"default": "multiDiff",
711717
"description": "%githubPullRequests.focusedMode.description%"
712718
},

package.nls.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@
144144
"githubIssues.queries.default.recentIssues": "Recent Issues",
145145
"githubIssues.assignWhenWorking.description": "Assigns the issue you're working on to you. Only applies when the issue you're working on is in a repo you currently have open.",
146146
"githubPullRequests.focusedMode.description": "The layout to use when a pull request is checked out. Set to false to prevent layout changes.",
147+
"githubPullRequests.focusedMode.firstDiff": "Show the first diff in the pull request. If there are no changes, show the overview.",
148+
"githubPullRequests.focusedMode.overview": "Show the overview of the pull request.",
149+
"githubPullRequests.focusedMode.multiDiff": "Show all diffs in the pull request. If there are no changes, show the overview.",
150+
"githubPullRequests.focusedMode.false": "Do not change the layout.",
147151
"githubPullRequests.showPullRequestNumberInTree.description": "Shows the pull request number in the tree view.",
148152
"githubPullRequests.labelCreated.description": "Group of labels that you want to add to the pull request automatically. Labels that don't exist in the repository won't be added.",
149153
"githubPullRequests.labelCreated.label.description": "Each string element is value of label that you want to add",

src/view/reviewManager.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,11 @@ export class ReviewManager extends Disposable {
632632
this._activePrViewCoordinator.show(pr);
633633
if (updateLayout) {
634634
const focusedMode = vscode.workspace.getConfiguration(PR_SETTINGS_NAMESPACE).get<'firstDiff' | 'overview' | 'multiDiff' | false>(FOCUSED_MODE);
635+
if (focusedMode && pr.fileChanges.size === 0) {
636+
// If there are no file changes, the only useful thing to show is the overview
637+
return this.openDescription();
638+
}
639+
635640
if (focusedMode === 'firstDiff') {
636641
if (this._reviewModel.localFileChanges.length) {
637642
this.openDiff();

0 commit comments

Comments
 (0)