fix: preserve pinned tab state when editing files #11327
Draft
+224
−1
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.
Related GitHub Issue
Closes: #11326
Description
This PR attempts to address Issue #11326. When RooCode edits a file, the
open()method inDiffViewProvidercloses 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:documentWasPinned = falsealongside the existingdocumentWasOpenpropertyopen(), before closing the tab, capturetab.isPinnedand store it inthis.documentWasPinnedsaveChanges(), aftershowTextDocument(), restore the pinned state usingvscode.commands.executeCommand("workbench.action.pinEditor")revertChanges(), apply the same pinning restoration when the document was previously openreset(), resetdocumentWasPinnedtofalseBoth
tab.isPinnedandworkbench.action.pinEditorare stable VS Code APIs (available since VS Code 1.69+).Test Procedure
DiffViewProvider.spec.tscovering:open()for both pinned and unpinned tabssaveChanges()(pinned and unpinned cases)revertChanges()(pinned, unpinned, and document-not-open cases)reset()cd src && npx vitest run integrations/editor/__tests__/DiffViewProvider.spec.tsPre-Submission Checklist
Documentation Updates
Additional Notes
Feedback and guidance are welcome.
Important
Preserve pinned tab state in
DiffViewProviderduring file edits by capturing and restoring the state.DiffViewProviderwhen editing files.open(), capturetab.isPinnedand store indocumentWasPinned.saveChanges()andrevertChanges(), restore pinned state usingvscode.commands.executeCommand("workbench.action.pinEditor").documentWasPinnedtofalseinreset().DiffViewProvider.spec.tsfor pin state capture and restoration inopen(),saveChanges(),revertChanges(), andreset().DiffViewProvider.spec.tsto support new tests.This description was created by
for e444c55. You can customize this summary. It will automatically update as commits are pushed.