-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
What specific problem does this solve?
When using Roo Code, users often accumulate many open Roo-related tabs (opened while editing). Manually closing these tabs is tedious and disrupts workflow, especially after completing a task or switching contexts. There is currently no efficient way to automatically close all Roo tabs or selectively close only those related to a specific task.
Who is affected?
All Roo Code users, especially those who work on multiple tasks or switch between projects frequently.
When does this happen?
After running tasks.
Current vs. expected behaviour:
Currently, users must close each Roo tab manually. With this feature, users can automatically close all Roo tabs opened by roo or all Roo tabs touched by roo.
Impact:
Saves time, reduces clutter, and improves focus by keeping the editor organized.
Additional context (optional)
Users have requested a way to quickly clean up Roo tabs after completing work.
There is already a reference implementation inside #2955
The refence implementation was also already extracted into its own branch.
This issue is part of a series of proposed features which came to be by the discussions in said pull request.
The proposed complete feature set being:
- Adding file based editing with the (least amount of control visually)
- Adding option to enable/disable autofocus to follow the visual editing process (most control visually)
- Adding option to open tabs in correct tab group if autofocus disabled
- Adding option to open tabs at the end of the tab list in the current tab group
- Adding settings to control tab closing behavior (opening tabs after edits, closing tabs after edits, closing all tabs of files touched
These should reside inside the FileEditingOptions proposed in Technical considerations
For a look at the complete feature set have a look into #2955
Roo Code Task Links (Optional)
No response
Request checklist
- I've searched existing Issues and Discussions for duplicates
- This describes a specific problem with clear impact and context
Interested in implementing this?
- Yes, I'd like to help implement this feature
Implementation requirements
- I understand this needs approval before implementation begins
How should this be solved? (REQUIRED if contributing, optional otherwise)
Introduce two user-configurable settings—autoCloseRooTabs and autoCloseAllRooTabs—that control automatic cleanup of Roo-related tabs in VS Code. When enabled, these settings ensure that tabs opened by Roo features (such as diff views and assistant messages) are closed automatically after relevant operations, reducing clutter and keeping the workspace focused.
The implementation should:
Track Roo-opened tabs during operations.
Use a unified, settings-driven mechanism to determine which tabs to close.
Integrate with existing tab management utilities to ensure only Roo tabs are affected.
Restore focus to the most relevant editor after cleanup.
This approach provides a seamless, low-friction experience for users who frequently interact with Roo features, helping them maintain an organized editor environment without manual tab management.
How will we know it works? (Acceptance Criteria - REQUIRED if contributing, optional otherwise)
Given I have multiple Roo tabs open
When I set autoCloseRooTabs
Then all Roo tabs related not open prior to the current task/session are closed
And non-Roo tabs remain open
Given I have Roo tabs from multiple tasks open
When I run autoCloseAllRooTabs
Then all Roo tabs are closed, regardless of having been open prior to task/session
And non-Roo tabs remain open
Technical considerations (REQUIRED if contributing, optional otherwise)
Use VSCode’s tab management API to enumerate and close tabs.
Identify Roo tabs by URI scheme, file extension, or metadata.
Ensure commands are accessible via command palette and can be bound to keyboard shortcuts.
Consider adding telemetry for feature usage (optional).
Test for edge cases (e.g., unsaved changes in Roo tabs).
Create a new PostEditBehaviorUtils class to handle all things executed after editing is done.
Concrete implementation idea:
Settings Integration:
The feature relies on two user settings (autoCloseRooTabs, autoCloseAllRooTabs) read from the roo-cline VSCode configuration. Add new FileEditingOptions options section inside webview-ui/src/components/settings/SettingsView.tsx.
Add the setting for (autoCloseRooTabs, autoCloseAllRooTabs) inside src/core/webview/webviewMessageHandler.ts etc.
Affected: DiffViewProvider and webview-ui/src/components/settings/SettingsView.tsx
Tab Tracking:
All Roo-opened tabs are tracked in a Set (rooOpenedTabs) within DiffViewProvider. This set is updated whenever Roo opens a tab, ensuring accurate identification for later cleanup. This is debatable and might be moved to PostEditBehaviorUtils. Unsure about that.
Tab Closing Logic:
The logic for determining which tabs to close is centralized in PostEditBehaviorUtils.
Diff tabs are identified by the custom URI scheme (cline-diff).
Text tabs are matched against the tracked rooOpenedTabs set.
The filter respects the difference between closing all Roo tabs or only those for the files not opened prior to the task, and handles edge cases (e.g., new vs. modified files, whether the file was already open).
Tab Closing Execution:
The actual closing is performed by PostEditBehaviorUtils, which iterates over all open tabs and closes those matching the filter.
Focus Restoration:
After closing tabs, focus is restored to either the pre-diff active editor or the edited file. This ensures a smooth user experience.
Extensibility:
The approach is modular: any Roo feature that opens tabs can add their URIs to rooOpenedTabs and benefit from the same cleanup logic. The same applies for the PostEditBehaviorUtils.
Performance:
The tab closing operation is asynchronous and uses Promise.all or Promise.allSettled to close tabs in parallel, minimizing UI lag even with many tabs.
Compatibility:
The logic is built on stable VSCode APIs for tab management and configuration, ensuring forward compatibility.
Potential blockers:
If VSCode changes its tab management API, adjustments may be required.
If other extensions manipulate Roo tabs, there could be race conditions or missed closures.
Testing:
Automated tests should verify that only Roo tabs are closed, that user tabs remain unaffected, and that focus is restored correctly. Edge cases (e.g., unsaved changes, rapid tab opening/closing) should be covered.
Trade-offs and risks (REQUIRED if contributing, optional otherwise)
Alternative approaches:
Could add a “close all Roo tabs” in command palette, but this is more of a task independent feature.
Potential negative impacts:
Accidental closure of tabs if detection is too broad. Mitigate by carefully matching only Roo-specific tabs.
Introduces a new settings section which might be conceived as "bloating" up the settings more.
Breaking changes:
None expected, as this only affects tab management.
Edge cases:
Unsaved Roo tabs should prompt for confirmation before closing, following VSCode’s default behaviour.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status