Skip to content

Commit ddfaf19

Browse files
Copilotalexr00
andauthored
Add setting to auto reveal open files in PR changes view (#8247)
* Initial plan * Initial plan for auto-reveal setting Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Add githubPullRequests.fileAutoReveal setting - Added new setting githubPullRequests.fileAutoReveal (default: true) - Added localization string for the setting - Added FILE_AUTO_REVEAL constant to settingKeys.ts - Updated repositoryChangesNode.ts to use the new setting instead of explorer.autoReveal - The setting controls whether files are automatically revealed in the PR changes tree when opened Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> * Clean up --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 07e3614 commit ddfaf19

File tree

4 files changed

+109
-106
lines changed

4 files changed

+109
-106
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,11 @@
313313
"default": false,
314314
"description": "%githubPullRequests.hideViewedFiles.description%"
315315
},
316+
"githubPullRequests.fileAutoReveal": {
317+
"type": "boolean",
318+
"default": true,
319+
"description": "%githubPullRequests.fileAutoReveal.description%"
320+
},
316321
"githubPullRequests.defaultDeletionMethod.selectLocalBranch": {
317322
"type": "boolean",
318323
"default": true,

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"githubPullRequests.notifications.description": "If GitHub notifications should be shown to the user.",
3939
"githubPullRequests.fileListLayout.description": "The layout to use when displaying changed files list.",
4040
"githubPullRequests.hideViewedFiles.description": "Hide files that have been marked as viewed in the pull request changes tree.",
41+
"githubPullRequests.fileAutoReveal.description": "Automatically reveal open files in the pull request changes tree.",
4142
"githubPullRequests.defaultDeletionMethod.selectLocalBranch.description": "When true, the option to delete the local branch will be selected by default when deleting a branch from a pull request.",
4243
"githubPullRequests.defaultDeletionMethod.selectRemote.description": "When true, the option to delete the remote will be selected by default when deleting a branch from a pull request.",
4344
"githubPullRequests.deleteBranchAfterMerge.description": "Automatically delete the branch after merging a pull request. This setting only applies when the pull request is merged through this extension.",

src/common/settingKeys.ts

Lines changed: 101 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,102 @@
1-
/*---------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
*--------------------------------------------------------------------------------------------*/
5-
6-
export const PR_SETTINGS_NAMESPACE = 'githubPullRequests';
7-
export const TERMINAL_LINK_HANDLER = 'terminalLinksHandler';
8-
export const BRANCH_PUBLISH = 'createOnPublishBranch';
9-
export const BRANCH_LIST_TIMEOUT = 'branchListTimeout';
10-
export const USE_REVIEW_MODE = 'useReviewMode';
11-
export const FILE_LIST_LAYOUT = 'fileListLayout';
12-
export const HIDE_VIEWED_FILES = 'hideViewedFiles';
13-
export const ASSIGN_TO = 'assignCreated';
14-
export const PUSH_BRANCH = 'pushBranch';
15-
export const IGNORE_PR_BRANCHES = 'ignoredPullRequestBranches';
16-
export const IGNORE_SUBMODULES = 'ignoreSubmodules';
17-
export const NEVER_IGNORE_DEFAULT_BRANCH = 'neverIgnoreDefaultBranch';
18-
export const OVERRIDE_DEFAULT_BRANCH = 'overrideDefaultBranch';
19-
export const PULL_BRANCH = 'pullBranch';
20-
export const PULL_REQUEST_DESCRIPTION = 'pullRequestDescription';
21-
export const NOTIFICATION_SETTING = 'notifications';
22-
export type NotificationVariants = 'off' | 'pullRequests';
23-
export const POST_CREATE = 'postCreate';
24-
export const POST_DONE = 'postDone';
25-
export const QUERIES = 'queries';
26-
export const PULL_REQUEST_LABELS = 'labelCreated';
27-
export const FOCUSED_MODE = 'focusedMode';
28-
export const CREATE_DRAFT = 'createDraft';
29-
export const QUICK_DIFF = 'quickDiff';
30-
export const SET_AUTO_MERGE = 'setAutoMerge';
31-
export const SHOW_PULL_REQUEST_NUMBER_IN_TREE = 'showPullRequestNumberInTree';
32-
export const DEFAULT_MERGE_METHOD = 'defaultMergeMethod';
33-
export const DEFAULT_DELETION_METHOD = 'defaultDeletionMethod';
34-
export const SELECT_LOCAL_BRANCH = 'selectLocalBranch';
35-
export const SELECT_REMOTE = 'selectRemote';
36-
export const DELETE_BRANCH_AFTER_MERGE = 'deleteBranchAfterMerge';
37-
export const REMOTES = 'remotes';
38-
export const PULL_PR_BRANCH_BEFORE_CHECKOUT = 'pullPullRequestBranchBeforeCheckout';
39-
export type PullPRBranchVariants = 'never' | 'pull' | 'pullAndMergeBase' | 'pullAndUpdateBase' | true | false;
40-
export const UPSTREAM_REMOTE = 'upstreamRemote';
41-
export const DEFAULT_CREATE_OPTION = 'defaultCreateOption';
42-
export const CREATE_BASE_BRANCH = 'createDefaultBaseBranch';
43-
44-
export const ISSUES_SETTINGS_NAMESPACE = 'githubIssues';
45-
export const ASSIGN_WHEN_WORKING = 'assignWhenWorking';
46-
export const ISSUE_COMPLETIONS = 'issueCompletions';
47-
export const USER_COMPLETIONS = 'userCompletions';
48-
export const ENABLED = 'enabled';
49-
export const IGNORE_USER_COMPLETION_TRIGGER = 'ignoreUserCompletionTrigger';
50-
export const CREATE_INSERT_FORMAT = 'createInsertFormat';
51-
export const ISSUE_BRANCH_TITLE = 'issueBranchTitle';
52-
export const USE_BRANCH_FOR_ISSUES = 'useBranchForIssues';
53-
export const WORKING_BASE_BRANCH = 'workingBaseBranch';
54-
export const WORKING_ISSUE_FORMAT_SCM = 'workingIssueFormatScm';
55-
export const IGNORE_COMPLETION_TRIGGER = 'ignoreCompletionTrigger';
56-
export const ISSUE_COMPLETION_FORMAT_SCM = 'issueCompletionFormatScm';
57-
export const CREATE_ISSUE_TRIGGERS = 'createIssueTriggers';
58-
export const DEFAULT = 'default';
59-
export const IGNORE_MILESTONES = 'ignoreMilestones';
60-
export const ALLOW_FETCH = 'allowFetch';
61-
export const ALWAYS_PROMPT_FOR_NEW_ISSUE_REPO = 'alwaysPromptForNewIssueRepo';
62-
export const ISSUE_AVATAR_DISPLAY = 'issueAvatarDisplay';
63-
export const EXPERIMENTAL_CHAT = 'experimental.chat';
64-
export const EXPERIMENTAL_USE_QUICK_CHAT = 'experimental.useQuickChat';
65-
export const EXPERIMENTAL_NOTIFICATIONS_PAGE_SIZE = 'experimental.notificationsViewPageSize';
66-
export const EXPERIMENTAL_NOTIFICATIONS_SCORE = 'experimental.notificationsScore';
67-
export const WEBVIEW_REFRESH_INTERVAL = 'webviewRefreshInterval';
68-
export const DEV_MODE = 'devMode';
69-
70-
// git
71-
export const GIT = 'git';
72-
export const PULL_BEFORE_CHECKOUT = 'pullBeforeCheckout';
73-
export const OPEN_DIFF_ON_CLICK = 'openDiffOnClick';
74-
export const SHOW_INLINE_OPEN_FILE_ACTION = 'showInlineOpenFileAction';
75-
export const AUTO_STASH = 'autoStash';
76-
export const BRANCH_WHITESPACE_CHAR = 'branchWhitespaceChar';
77-
export const BRANCH_RANDOM_NAME_DICTIONARY = 'branchRandomName.dictionary';
78-
79-
// GitHub Enterprise
80-
export const GITHUB_ENTERPRISE = 'github-enterprise';
81-
export const URI = 'uri';
82-
83-
// Editor
84-
export const EDITOR = 'editor';
85-
export const WORD_WRAP = 'wordWrap';
86-
87-
// Comments
88-
export const COMMENTS = 'comments';
89-
export const OPEN_VIEW = 'openView';
90-
91-
// Explorer
92-
export const EXPLORER = 'explorer';
93-
export const AUTO_REVEAL = 'autoReveal';
94-
95-
// Workbench
96-
export const WORKBENCH = 'workbench';
97-
export const COLOR_THEME = 'colorTheme';
98-
99-
// Coding Agent
100-
101-
export const CODING_AGENT = `${PR_SETTINGS_NAMESPACE}.codingAgent`;
102-
export const CODING_AGENT_ENABLED = 'enabled';
103-
export const CODING_AGENT_AUTO_COMMIT_AND_PUSH = 'autoCommitAndPush';
104-
export const CODING_AGENT_PROMPT_FOR_CONFIRMATION = 'promptForConfirmation';
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
export const PR_SETTINGS_NAMESPACE = 'githubPullRequests';
7+
export const TERMINAL_LINK_HANDLER = 'terminalLinksHandler';
8+
export const BRANCH_PUBLISH = 'createOnPublishBranch';
9+
export const BRANCH_LIST_TIMEOUT = 'branchListTimeout';
10+
export const USE_REVIEW_MODE = 'useReviewMode';
11+
export const FILE_LIST_LAYOUT = 'fileListLayout';
12+
export const HIDE_VIEWED_FILES = 'hideViewedFiles';
13+
export const FILE_AUTO_REVEAL = 'fileAutoReveal';
14+
export const ASSIGN_TO = 'assignCreated';
15+
export const PUSH_BRANCH = 'pushBranch';
16+
export const IGNORE_PR_BRANCHES = 'ignoredPullRequestBranches';
17+
export const IGNORE_SUBMODULES = 'ignoreSubmodules';
18+
export const NEVER_IGNORE_DEFAULT_BRANCH = 'neverIgnoreDefaultBranch';
19+
export const OVERRIDE_DEFAULT_BRANCH = 'overrideDefaultBranch';
20+
export const PULL_BRANCH = 'pullBranch';
21+
export const PULL_REQUEST_DESCRIPTION = 'pullRequestDescription';
22+
export const NOTIFICATION_SETTING = 'notifications';
23+
export type NotificationVariants = 'off' | 'pullRequests';
24+
export const POST_CREATE = 'postCreate';
25+
export const POST_DONE = 'postDone';
26+
export const QUERIES = 'queries';
27+
export const PULL_REQUEST_LABELS = 'labelCreated';
28+
export const FOCUSED_MODE = 'focusedMode';
29+
export const CREATE_DRAFT = 'createDraft';
30+
export const QUICK_DIFF = 'quickDiff';
31+
export const SET_AUTO_MERGE = 'setAutoMerge';
32+
export const SHOW_PULL_REQUEST_NUMBER_IN_TREE = 'showPullRequestNumberInTree';
33+
export const DEFAULT_MERGE_METHOD = 'defaultMergeMethod';
34+
export const DEFAULT_DELETION_METHOD = 'defaultDeletionMethod';
35+
export const SELECT_LOCAL_BRANCH = 'selectLocalBranch';
36+
export const SELECT_REMOTE = 'selectRemote';
37+
export const DELETE_BRANCH_AFTER_MERGE = 'deleteBranchAfterMerge';
38+
export const REMOTES = 'remotes';
39+
export const PULL_PR_BRANCH_BEFORE_CHECKOUT = 'pullPullRequestBranchBeforeCheckout';
40+
export type PullPRBranchVariants = 'never' | 'pull' | 'pullAndMergeBase' | 'pullAndUpdateBase' | true | false;
41+
export const UPSTREAM_REMOTE = 'upstreamRemote';
42+
export const DEFAULT_CREATE_OPTION = 'defaultCreateOption';
43+
export const CREATE_BASE_BRANCH = 'createDefaultBaseBranch';
44+
45+
export const ISSUES_SETTINGS_NAMESPACE = 'githubIssues';
46+
export const ASSIGN_WHEN_WORKING = 'assignWhenWorking';
47+
export const ISSUE_COMPLETIONS = 'issueCompletions';
48+
export const USER_COMPLETIONS = 'userCompletions';
49+
export const ENABLED = 'enabled';
50+
export const IGNORE_USER_COMPLETION_TRIGGER = 'ignoreUserCompletionTrigger';
51+
export const CREATE_INSERT_FORMAT = 'createInsertFormat';
52+
export const ISSUE_BRANCH_TITLE = 'issueBranchTitle';
53+
export const USE_BRANCH_FOR_ISSUES = 'useBranchForIssues';
54+
export const WORKING_BASE_BRANCH = 'workingBaseBranch';
55+
export const WORKING_ISSUE_FORMAT_SCM = 'workingIssueFormatScm';
56+
export const IGNORE_COMPLETION_TRIGGER = 'ignoreCompletionTrigger';
57+
export const ISSUE_COMPLETION_FORMAT_SCM = 'issueCompletionFormatScm';
58+
export const CREATE_ISSUE_TRIGGERS = 'createIssueTriggers';
59+
export const DEFAULT = 'default';
60+
export const IGNORE_MILESTONES = 'ignoreMilestones';
61+
export const ALLOW_FETCH = 'allowFetch';
62+
export const ALWAYS_PROMPT_FOR_NEW_ISSUE_REPO = 'alwaysPromptForNewIssueRepo';
63+
export const ISSUE_AVATAR_DISPLAY = 'issueAvatarDisplay';
64+
export const EXPERIMENTAL_CHAT = 'experimental.chat';
65+
export const EXPERIMENTAL_USE_QUICK_CHAT = 'experimental.useQuickChat';
66+
export const EXPERIMENTAL_NOTIFICATIONS_PAGE_SIZE = 'experimental.notificationsViewPageSize';
67+
export const EXPERIMENTAL_NOTIFICATIONS_SCORE = 'experimental.notificationsScore';
68+
export const WEBVIEW_REFRESH_INTERVAL = 'webviewRefreshInterval';
69+
export const DEV_MODE = 'devMode';
70+
71+
// git
72+
export const GIT = 'git';
73+
export const PULL_BEFORE_CHECKOUT = 'pullBeforeCheckout';
74+
export const OPEN_DIFF_ON_CLICK = 'openDiffOnClick';
75+
export const SHOW_INLINE_OPEN_FILE_ACTION = 'showInlineOpenFileAction';
76+
export const AUTO_STASH = 'autoStash';
77+
export const BRANCH_WHITESPACE_CHAR = 'branchWhitespaceChar';
78+
export const BRANCH_RANDOM_NAME_DICTIONARY = 'branchRandomName.dictionary';
79+
80+
// GitHub Enterprise
81+
export const GITHUB_ENTERPRISE = 'github-enterprise';
82+
export const URI = 'uri';
83+
84+
// Editor
85+
export const EDITOR = 'editor';
86+
export const WORD_WRAP = 'wordWrap';
87+
88+
// Comments
89+
export const COMMENTS = 'comments';
90+
export const OPEN_VIEW = 'openView';
91+
92+
// Workbench
93+
export const WORKBENCH = 'workbench';
94+
export const COLOR_THEME = 'colorTheme';
95+
96+
// Coding Agent
97+
98+
export const CODING_AGENT = `${PR_SETTINGS_NAMESPACE}.codingAgent`;
99+
export const CODING_AGENT_ENABLED = 'enabled';
100+
export const CODING_AGENT_AUTO_COMMIT_AND_PUSH = 'autoCommitAndPush';
101+
export const CODING_AGENT_PROMPT_FOR_CONFIRMATION = 'promptForConfirmation';
105102
export const SHOW_CODE_LENS = 'codeLens';

src/view/treeNodes/repositoryChangesNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as vscode from 'vscode';
77
import { Repository } from '../../api/api';
88
import Logger, { PR_TREE } from '../../common/logger';
9-
import { AUTO_REVEAL, EXPLORER } from '../../common/settingKeys';
9+
import { FILE_AUTO_REVEAL, PR_SETTINGS_NAMESPACE } from '../../common/settingKeys';
1010
import { DataUri, Schemes } from '../../common/uri';
1111
import { FolderRepositoryManager } from '../../github/folderRepositoryManager';
1212
import { PullRequestModel } from '../../github/pullRequestModel';
@@ -51,7 +51,7 @@ export class RepositoryChangesNode extends TreeNode implements vscode.TreeItem {
5151
this.getTreeItem();
5252

5353
this._register(vscode.window.onDidChangeActiveTextEditor(e => {
54-
if (vscode.workspace.getConfiguration(EXPLORER).get(AUTO_REVEAL)) {
54+
if (vscode.workspace.getConfiguration(PR_SETTINGS_NAMESPACE).get(FILE_AUTO_REVEAL)) {
5555
const tabInput = vscode.window.tabGroups.activeTabGroup.activeTab?.input;
5656
if (tabInput instanceof vscode.TabInputTextDiff) {
5757
if ((tabInput.original.scheme === Schemes.Review)

0 commit comments

Comments
 (0)