Open Tabs at the End of Tab List if Auto Focus Disabled

#6006

Issue Details

about 1 month ago
felixAnhalt
felixAnhalt
enhancementIssue - In Progressproposal
felixAnhaltfelixAnhalt
opened about 1 month ago
Author

What specific problem does this solve?

When Roo opens new tabs (such as diff editors), they may appear in the middle of the tab list, disrupting the user’s preferred tab order. Users who rely on a specific tab arrangement want new Roo tabs to always open at the end of the current group’s tab list for better organization and predictability.

Who is affected?

Users who manage many tabs and care about tab order in VS Code.

When does this happen?

When Roo opens new tabs as part of its operations.

Current vs. expected behaviour:

Currently, Roo tabs may open in arbitrary positions. With this feature, Roo tabs will always open at the end of the group’s tab list where the task was started.

Impact:

Improves workflow for users who want to keep their tab order organized and predictable.

Additional context (optional)

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. This issue makes sense after #5672

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

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)

Add a user setting openTabsAtEndOfList (default: false). When enabled, Roo will: Detect the last tab in the active group before opening a new Roo tab. Open the new Roo tab after the last tab. If disabled, Roo will use the default VS Code tab placement.

How will we know it works? (Acceptance Criteria - REQUIRED if contributing, optional otherwise)

Given I have several tabs open in a group When I open a Roo diff or related tab with openTabsAtEndOfList enabled Then the new Roo tab appears at the end of the tab list in the active group And the existing tab order is preserved But no tabs are moved or reordered unexpectedly

Given the openTabsAtEndOfList setting is disabled When I open a Roo tab Then the tab opens in the default position as determined by VS Code And tab order is not explicitly managed by Roo

Technical considerations (REQUIRED if contributing, optional otherwise)

The setting is read from the VSCode config in DiffViewProvider. Placement logic is handled in DiffViewProvider. Uses VSCode’s stable tab/group APIs for compatibility. Automated tests should verify correct tab placement and order in various scenarios. Add new FileEditingOptions options section inside webview-ui/src/components/settings/SettingsView.tsx. Add the setting for openTabsAtEndOfList inside src/core/webview/webviewMessageHandler.ts etc.

Affected: DiffViewProvider and webview-ui/src/components/settings/SettingsView.tsx

Trade-offs and risks (REQUIRED if contributing, optional otherwise)

If VSCode changes its tab/group APIs, adjustments may be needed. Edge cases may arise with rapid tab opening/closing, but the logic is modular and easily extendable. Because we need to showTextDocument for the last file inside the tab group, this steals focus for a short period of time.