Skip to content

feat(web): drag files from the explorer into the chat composer#4140

Open
yordis wants to merge 2 commits into
pingdotgg:mainfrom
TrogonStack:yordis/feat-file-tree-drag-to-chat-upstream
Open

feat(web): drag files from the explorer into the chat composer#4140
yordis wants to merge 2 commits into
pingdotgg:mainfrom
TrogonStack:yordis/feat-file-tree-drag-to-chat-upstream

Conversation

@yordis

@yordis yordis commented Jul 18, 2026

Copy link
Copy Markdown
Contributor
  • Dragging a file from the explorer onto the composer is the natural follow-up to the context-menu mention actions from feat: file explorer mention actions and zoom-aware context menus #4054; today that gesture silently does nothing, so the only way to reference a visible file is through the menu.
  • Dropping a tree row inserts the same mention pill the menu produces, keeping one consistent path for adding file context to a message.
  • Text selections dragged from the panel chrome and drops while the composer cannot accept input are rejected, so the gesture cannot produce broken pills.

Note

Low Risk
UI-only composer and file-browser interaction changes with unit tests; no auth, API, or data-layer changes.

Overview
Users can drag workspace file-tree rows onto the chat composer to insert the same serialized file-link mentions as the context menu, instead of the gesture doing nothing.

The file browser tags row drags with a custom application/x-t3code-composer-mention payload (single or multi-selection), enables row dragging without in-tree reordering, suppresses “open file” on selection changes during a drag, and deselects dragged rows when the drag ends. ChatComposer handles these drags in the capture phase (native stop propagation, move drop effect, no synchronous editor focus) so the Lexical editor does not overwrite the insert; it reuses shared end-of-prompt insert logic and shows an error toast when the composer cannot accept input. OS file drops and non-row text drags are left unchanged.

Reviewed by Cursor Bugbot for commit c3f8442. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add drag-and-drop support for files from the explorer into the chat composer

  • Adds a fileTreeDragMention controller in fileTreeDragMention.ts that intercepts dragstart events on file tree rows and populates the drag data store with serialized composer mention payloads.
  • Adds composerMentionDrag handlers in composerMentionDrag.ts that detect these payloads on drop and insert file-link mentions at the end of the composer prompt.
  • Updates FileBrowserPanel.tsx to disable intra-tree dropping, suppress file-open on drag-triggered selection changes, and deselect dragged rows at drag end.
  • Updates ChatComposer.tsx to wire capture-phase drag event handlers and show an error toast when mention insertion is rejected.
  • Behavioral Change: dragging a selected row now drags all selected rows as mentions; dragging an unselected row drags only that row.

Macroscope summarized c3f8442.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 260570f3-6e42-4e44-8ae3-ed4cf2335fdb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jul 18, 2026
Comment thread apps/web/src/components/chat/ChatComposer.tsx
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces a new user-facing feature (drag-and-drop from file explorer to chat composer) with new modules and integration between two systems. New user-facing capabilities warrant human review regardless of implementation quality.

You can customize Macroscope's approvability policy. Learn more.

Dropped mentions bypassed the project-selection and pending-input guards and skipped the leading boundary, so a drop after existing text rendered raw markdown instead of a pill.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis

yordis commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author
Screen.Recording.2026-07-18.at.4.47.25.PM.mov

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant