Skip to content

#222 Fix multi-select for file tabs in editor/title/context commands#341

Open
Copilot wants to merge 3 commits intomainfrom
copilot/222-fix-multi-select-file-tabs
Open

#222 Fix multi-select for file tabs in editor/title/context commands#341
Copilot wants to merge 3 commits intomainfrom
copilot/222-fix-multi-select-file-tabs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 24, 2026

Ctrl+Click multi-select on file tabs only processed the right-clicked file — not all selected tabs — while explorer multi-select worked correctly.

Root Cause

registerCommand used ...files: VSCode.Uri[] + .flat(), which obscured VS Code's actual two-argument contract for context menu commands:

  • args[0] (clickedUri: Uri): right-clicked item
  • args[1] (allSelectedUris: Uri[]): all Ctrl+Click selected items (passed for both explorer/context and editor/title/context since VS Code 1.82)

Changes

src/editor/commands.ts

Replaced the implicit rest-param + flatten approach with an explicit two-arg signature matching VS Code's API contract. Merges both args and deduplicates, covering the edge case where clickedUri may not appear in allSelectedUris:

// Before
(...files: VSCode.Uri[]) => {
    const filePaths = files.flat().map(file => file.path).filter(path => path !== undefined);
    registry.callbackAction(Lib.removeDuplicates(filePaths) as string[]);
}

// After
(clickedUri?: VSCode.Uri, allSelectedUris?: VSCode.Uri[]) => {
    const uris = [...(allSelectedUris ?? []), ...(clickedUri ? [clickedUri] : [])];
    const filePaths = uris.map(uri => uri.path).filter((path): path is string => path !== undefined);
    registry.callbackAction(Lib.removeDuplicates(filePaths) as string[]);
}

src/devtools/index.ts

Corrected misleading comment in activateMenuCommands: the activeTabFilePath fallback applies to editor/context (right-click inside editor body, no URI passed by VS Code), not to file tabs.

Documentation

N/A

Issues

Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG] multi-select does not work for file tabs</issue_title>
<issue_description>Describe the bug
when selecting multiple files the the explorer view and then using one of the context menu options, it is executed for all that were selected. if you try the same file tabs, only one of the files actually gets retrieve/deployed/copied

image

ideally, all selected (CTRL+click) items get handed to the logic</issue_description>

<agent_instructions>prefix every commit message and pr title with "#222 "</agent_instructions>

Comments on the Issue (you are @copilot in this section)


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Copilot AI changed the title [WIP] #222 Fix multi-select not working for file tabs #222 Fix multi-select for file tabs in editor/title/context commands Mar 24, 2026
Copilot AI requested a review from JoernBerkefeld March 24, 2026 13:26
@JoernBerkefeld JoernBerkefeld marked this pull request as ready for review March 24, 2026 14:52
@JoernBerkefeld JoernBerkefeld requested a review from Copilot March 24, 2026 14:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes context-menu multi-select behavior for file tabs by aligning command handler signatures with VS Code’s actual (clickedUri, allSelectedUris) argument contract, so tab multi-selection is processed the same way as Explorer multi-selection.

Changes:

  • Update the command registration wrapper to explicitly accept (clickedUri?: Uri, allSelectedUris?: Uri[]), merge both inputs, and dedupe paths.
  • Clarify the activateMenuCommands fallback comment to correctly describe the editor/context (editor body) behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/editor/commands.ts Adjusts command handler signature to correctly collect all selected tab URIs (plus clicked URI) and deduplicate paths.
src/devtools/index.ts Corrects a comment describing when the “active editor path” fallback applies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

[BUG] multi-select does not work for file tabs

3 participants