Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Feb 9, 2026

Related GitHub Issue

Closes: #11326

Description

This PR attempts to address Issue #11326. When RooCode edits a file, the open() method in DiffViewProvider closes the existing tab before opening a diff editor, destroying the tab's pinned state. When the edit is accepted or rejected, the file is reopened but the pinned state is never restored.

Changes in src/integrations/editor/DiffViewProvider.ts:

  1. Added a new private property documentWasPinned = false alongside the existing documentWasOpen property
  2. In open(), before closing the tab, capture tab.isPinned and store it in this.documentWasPinned
  3. In saveChanges(), after showTextDocument(), restore the pinned state using vscode.commands.executeCommand("workbench.action.pinEditor")
  4. In revertChanges(), apply the same pinning restoration when the document was previously open
  5. In reset(), reset documentWasPinned to false

Both tab.isPinned and workbench.action.pinEditor are stable VS Code APIs (available since VS Code 1.69+).

Test Procedure

  • Added 8 new tests in DiffViewProvider.spec.ts covering:
    • Pin state capture in open() for both pinned and unpinned tabs
    • Pin state restoration in saveChanges() (pinned and unpinned cases)
    • Pin state restoration in revertChanges() (pinned, unpinned, and document-not-open cases)
    • Pin state cleanup in reset()
  • All 23 tests pass: cd src && npx vitest run integrations/editor/__tests__/DiffViewProvider.spec.ts

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes.
  • Documentation Impact: No documentation updates are required.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Additional Notes

Feedback and guidance are welcome.


Important

Preserve pinned tab state in DiffViewProvider during file edits by capturing and restoring the state.

  • Behavior:
    • Capture and restore pinned tab state in DiffViewProvider when editing files.
    • In open(), capture tab.isPinned and store in documentWasPinned.
    • In saveChanges() and revertChanges(), restore pinned state using vscode.commands.executeCommand("workbench.action.pinEditor").
    • Reset documentWasPinned to false in reset().
  • Tests:
    • Added 8 tests in DiffViewProvider.spec.ts for pin state capture and restoration in open(), saveChanges(), revertChanges(), and reset().
    • Tests cover both pinned and unpinned scenarios, and document-not-open cases.
  • Misc:
    • Minor changes to mock implementations in DiffViewProvider.spec.ts to support new tests.

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

When RooCode edits a file, it closes the existing tab and opens a diff
editor. After accepting or rejecting changes, the file is reopened but
the pinned state is lost.

This fix captures the tab isPinned state before closing, then restores
it after reopening via workbench.action.pinEditor command in both
saveChanges and revertChanges flows.

Closes #11326
@roomote
Copy link
Contributor Author

roomote bot commented Feb 9, 2026

Rooviewer Clock   See task

Reviewed all changes. No issues found. The implementation is minimal, correct, and well-tested.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@pdecat
Copy link
Contributor

pdecat commented Feb 9, 2026

Cherry picked this locally and it works great!

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Pinned tabs are unpinned when edited by RooCode

2 participants