Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 25, 2025

Summary

This PR fixes the diff editor timeout issue that started appearing in v3.20.3, where users would get the error "Failed to open diff editor within 10 seconds. The editor may be blocked or VS Code may be unresponsive."

Problem

The issue was introduced when trying to fix markdown preview associations by pre-opening files as text documents. When a file is pre-opened, the subsequent diff command might not trigger the expected onDidOpenTextDocument event because the document is already open, causing the 10-second timeout to trigger.

Solution

Added an immediate check for visible diff editor after the diff command execution. This handles cases where the document was pre-opened and events might not fire as expected.

Changes

  • Modified openDiffEditor() method in DiffViewProvider.ts to check if the diff editor is already visible after executing the diff command
  • Added a small delay (100ms) to ensure UI updates before checking
  • If the editor is found immediately, it resolves without waiting for events
  • Added test case to verify the fix works correctly

Testing

  • All existing tests pass
  • Added new test to verify immediate resolution when diff editor is already visible
  • Manually tested the scenario described in the issue

Fixes #6199


Important

Fixes diff editor timeout in DiffViewProvider.ts by checking editor visibility post-command execution, with a new test added.

  • Behavior:
    • Fixes timeout issue in openDiffEditor() in DiffViewProvider.ts by checking if the diff editor is visible after executing the diff command.
    • Adds a 100ms delay to ensure UI updates before checking visibility.
    • Resolves immediately if the editor is found, avoiding the 10-second timeout.
  • Testing:
    • Adds test case in DiffViewProvider.spec.ts to verify immediate resolution when the diff editor is already visible.
    • All existing tests pass, and the new test confirms the fix.
  • Misc:
    • Minor formatting changes in DiffViewProvider.ts.

This description was created by Ellipsis for 3d9d0ae. You can customize this summary. It will automatically update as commits are pushed.

- Add immediate check for visible diff editor after command execution
- Handles cases where document open events may not fire for pre-opened files
- Fixes timeout error "Failed to open diff editor within 10 seconds"
- Add test to verify the fix works correctly

Fixes #6199
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 25, 2025 05:07
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Jul 25, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 25, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jul 28, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 28, 2025
@daniel-lxs
Copy link
Member

Closing since I can't repro the issue right now

@daniel-lxs daniel-lxs closed this Jul 29, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Jul 29, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PR - Needs Preliminary Review size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Failed to open diff editor within 10 seconds

4 participants