Change markFileAsViewed to keep files open by default
Overview
When marking a file as viewed through the editor menu bar or keybinding, the file would automatically close. This behavior differed from using the tree view checkbox, which kept files open. This PR makes "keep open" the default for consistency, while providing a setting for users who prefer the old behavior.
Changes
- Added new setting
githubPullRequests.closeFileOnMarkFileAsViewed(default: false) - Modified the markFileAsViewed command to respect this setting
- Default behavior now matches tree view (keeps files open)
- Users can opt-in to the old behavior via settings
Demo
New Default Behavior
Default behavior: The File remains open after marking as viewed
Optional Behavior (Setting Enabled)
The screenshot below shows that the readme.md file closed when the checkmark was clicked
Optional behavior: File closes when setting is enabled
Configuration
Testing
Verified:
- Default behavior (false) - files stay open when marked as viewed
- Optional behavior (true) - files close when marked as viewed
- Setting can be changed through VS Code settings UI
- Tree view behavior remains unchanged
Fixes #5092
@microsoft-github-policy-service agree
I'm not a maintainer - but I'm wondering if the additional setting and change in default behavior is necessary. Given that we can pre-define arguments passed to keybinding commands it should be sufficient to only add the optional argument (changing the default to close the file to keep existing behavior intact) to the command itself while achieving the same end result.