Skip to content

web: allow multi-select / multi-file drag from the file tree into the prompt #48131

Open

Description

@Jweokk

Verified

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

I self-host opencode and mostly use it from the browser. When I'm composing a task I often need to reference a handful of files from the right-side file tree, but right now that means dragging them into the prompt one at a time.

What I do today: drag file 1 from the tree into the composer, go back to the tree, drag file 2, and so on. With 4-5 files this gets tedious, and it's easy to lose your place in the tree between drags.

What I'd like: select several files in the tree (ctrl/shift-click, or any multi-row drag) and drop them into the prompt once, with each file becoming its own @mention.

I did some digging in the client code to see what this would involve:

  • In packages/app/src/components/file-tree-v2.tsx each row's onDragStart puts a single file:<path> into text/plain, and rows have no notion of being part of a multi-row selection.
  • On the receiving side (packages/session-ui/src/v2/components/prompt-input/attachments.ts), the drop handler reads that one path and inserts one @mention. The dataTransfer.files branch (which does handle N files) is only populated for OS-level drags, not for drags that start inside the page.

So my read is this needs (a) some form of multi-select in the tree and (b) a drag payload that carries several paths (e.g. a custom mime type like application/x-opencode-paths, one path per line in text/plain, anything really) plus a drop handler that inserts one mention per path.

For the record I searched before posting; closest things I found were #39705 (desktop: dropping a second file sequentially fails — related surface, different problem) and #31939 (external files should offer insert-path mode — also related, but about OS files rather than tree rows).

I noticed CONTRIBUTING asks for design review on UI features, so I'm posting here first. I'm happy to attempt a PR if a maintainer tells me the preferred shape for the multi-select + payload.

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed write-up, @Jweokk! You're asking for multi-select in the web file tree (ctrl/shift-click) so you can drag several files into the prompt at once, with each one becoming its own @mention. Maintainers will consider it.

    One note for a future PR: the code has moved since the paths you cited.

    • The tree row's drag payload now comes from startFileDrag in packages/gui-plugins/src/file/drag.ts. It sets one file:<path> in text/plain and one text/uri-list entry.
    • The drop is handled in packages/app/src/composer/attachments/attachments.ts, which reads a single file: path. Only drops from the operating system go through the dataTransfer.files branch that handles several files.

    Since this is a UI change, please wait for a maintainer to agree on the selection model and payload format before you start on a PR.

    Related issues:

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions