Skip to content

fix(vscode): reopen files that were open before diff view - #440

Merged
wsxiaoys merged 2 commits into
mainfrom
fix/revert-open
Sep 26, 2025
Merged

fix(vscode): reopen files that were open before diff view#440
wsxiaoys merged 2 commits into
mainfrom
fix/revert-open

Conversation

@zhanba

@zhanba zhanba commented Sep 26, 2025

Copy link
Copy Markdown
Member

Screen record

Summary

  • Fixes issue where files open in VSCode before creating a diff view would remain closed after accepting or rejecting changes
  • Tracks whether a file was open before the diff view via wasFileOpenBeforeDiff property
  • Automatically reopens the file after applying changes if it was previously open
  • Adds isFileCurrentlyOpen utility to detect open files (excluding diff views)

This improves the user experience by preserving their workspace state when working with diff views.

Changes

  • Added wasFileOpenBeforeDiff property to DiffView class to track file state
  • Modified DiffView constructor to accept and store the open file state
  • Enhanced acceptChanges method to conditionally reopen files
  • Added isFileCurrentlyOpen utility function to check if file is open in tabs
  • Updated DiffView.create to detect and pass the current file state

Test plan

  • Verify that files open before diff view are reopened after accepting changes
  • Verify that files not previously open remain closed after diff operations
  • Test with various file types and edge cases
  • Ensure no regression in existing diff view functionality

🤖 Generated with Pochi

This fix addresses an issue where files that were open in VSCode before
creating a diff view would remain closed after accepting or rejecting
changes. The solution:

- Tracks whether a file was open before the diff view via wasFileOpenBeforeDiff
- Automatically reopens the file after applying changes if it was previously open
- Adds isFileCurrentlyOpen utility to detect open files (excluding diff views)
- Preserves user's workspace state and improves UX

🤖 Generated with [Pochi](https://getpochi.com)

Co-Authored-By: Pochi <noreply@getpochi.com>

@wsxiaoys wsxiaoys left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few nits, otherwise LGTM

Comment thread packages/vscode/src/integrations/editor/diff-view.ts Outdated
Comment thread packages/vscode/src/integrations/editor/diff-view.ts Outdated
@wsxiaoys
wsxiaoys added this pull request to the merge queue Sep 26, 2025
Merged via the queue into main with commit 127c95e Sep 26, 2025
3 checks passed
@wsxiaoys
wsxiaoys deleted the fix/revert-open branch September 26, 2025 08:00
@wsxiaoys wsxiaoys moved this to Done in Pochi Tasks Sep 26, 2025
@wsxiaoys wsxiaoys moved this from Done to Verified in Pochi Tasks Sep 26, 2025
@wsxiaoys wsxiaoys moved this from Verified to Archived in Pochi Tasks Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Archived

Development

Successfully merging this pull request may close these issues.

2 participants