Add option to keep viewed files open#8859
Open
pratyushsinghal7 wants to merge 3 commits into
microsoft:mainmicrosoft/vscode-pull-request-github:mainfrom
pratyushsinghal7:issue-5092pratyushsinghal7/vscode-pull-request-github:issue-5092Copy head branch name to clipboard
Open
Add option to keep viewed files open#8859pratyushsinghal7 wants to merge 3 commits intomicrosoft:mainmicrosoft/vscode-pull-request-github:mainfrom pratyushsinghal7:issue-5092pratyushsinghal7/vscode-pull-request-github:issue-5092Copy head branch name to clipboard
pratyushsinghal7 wants to merge 3 commits into
microsoft:mainmicrosoft/vscode-pull-request-github:mainfrom
pratyushsinghal7:issue-5092pratyushsinghal7/vscode-pull-request-github:issue-5092Copy head branch name to clipboard
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in command argument to prevent pr.markFileAsViewed from closing the active editor (useful for keybindings / editor menu usage), while keeping the existing default behavior, and introduces a regression test for the “don’t close” path.
Changes:
- Extend
pr.markFileAsViewedto accept a{ dontCloseFile }options object and skip the tab-close behavior when requested. - Refactor the command’s argument handling to support keybinding-style
args. - Add a test asserting the active tab remains open when
dontCloseFile: true.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/commands.ts |
Adds { dontCloseFile } option handling and gates the “close active tab” behavior behind it. |
src/test/extension.test.ts |
Adds a regression test to ensure the active editor tab stays open when dontCloseFile is true. |
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/commands.ts:1805
- The new
optionsparameter is only applied in the non-FileChangeNode/Uribranch (options = treeNodeOrOptions ?? options), so when the command is invoked with an explicitvscode.Uriplus an options object (e.g.executeCommand('pr.markFileAsViewed', uri, { dontCloseFile: true })),dontCloseFileis ignored and the tab will still close. Either apply the second-argument options consistently for all invocation shapes, or remove/rename the second parameter to avoid suggesting it’s supported forUriinvocations.
vscode.commands.registerCommand('pr.markFileAsViewed', async (treeNodeOrOptions: FileChangeNode | vscode.Uri | { dontCloseFile: boolean } | undefined, options?: { dontCloseFile: boolean }) => {
try {
let treeNode: FileChangeNode | vscode.Uri | undefined;
if (treeNodeOrOptions instanceof FileChangeNode || treeNodeOrOptions instanceof vscode.Uri) {
treeNode = treeNodeOrOptions;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dontCloseFileoption in thepr.markFileAsViewedcommandTesting
npm run compile:testnpx eslint src/commands.tsnpm run hygienenpm run check:commandsgit diff --checkFixes #5092