Skip to content

feat: file explorer mention actions and zoom-aware context menus#4054

Open
yordis wants to merge 4 commits into
pingdotgg:mainfrom
TrogonStack:yordis/feat-file-explorer-mentions-upstream
Open

feat: file explorer mention actions and zoom-aware context menus#4054
yordis wants to merge 4 commits into
pingdotgg:mainfrom
TrogonStack:yordis/feat-file-explorer-mentions-upstream

Conversation

@yordis

@yordis yordis commented Jul 16, 2026

Copy link
Copy Markdown
  • Attaching files to a prompt required typing @-mentions by hand even though the file explorer already has the file in front of you; right-click now offers Copy mention and Add to chat so browsing and prompting stay in one flow.
  • Copied mention text degraded to plain text on paste because the composer only tokenized programmatic inserts, which made sharing mentions between surfaces pointless.
  • Native context menus drifted away from the cursor whenever the window was zoomed, proportionally to the distance from the window origin, so the new file-explorer menu (far right edge) was unusable while left-edge menus only looked fine by accident; every coordinate-positioned menu in the desktop app was affected.

Note

Low Risk
Localized UX changes to composer paste/insert and menu positioning; no auth or data-model changes, with unit coverage for zoom scaling.

Overview
The file browser gains a right-click menu with Copy mention and Add to chat, using the native desktop context menu API and a capture-phase listener so popup coordinates stay at the cursor when the tree’s anchor rect is unreliable.

Add to chat appends a serialized file mention through insertTextAtEnd, which now accepts ensureLeadingBoundary so mentions don’t run into existing prompt text. Copy mention puts the same token on the clipboard; pasting into the composer is handled by a new ComposerInlineTokenPastePlugin that turns pasted mention syntax into structured mention nodes (with spacing rules aligned to autocomplete).

On desktop, context menu placement multiplies renderer CSS coordinates by the window getZoomFactor() before Menu.popup(), fixing menus that drift when the app is zoomed (including other surfaces that pass clientX/clientY).

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

Note

Add file explorer right-click context menu with mention actions and zoom-aware positioning

  • Right-clicking a file tree entry in FileBrowserPanel.tsx opens a context menu with "Copy mention" and "Add to chat" actions; pointer coordinates are captured via a capture-phase listener to work around shadow DOM anchor rect limitations.
  • "Add to chat" calls insertTextAtEnd on the composer handle with a new ensureLeadingBoundary option that prepends a space when the prompt doesn't end in whitespace.
  • Pasting text into the composer now detects inline mention tokens and converts them into composer mention nodes, preserving line breaks and adding boundary whitespace as needed.
  • Context menu popup coordinates in ElectronMenu.ts are now scaled by the window's zoom factor and floored, so menus appear at the correct position on zoomed windows.

Macroscope summarized a9caa6f.

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

coderabbitai Bot commented Jul 16, 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: 23d9cf6e-344c-47af-89de-bfa93b5d6be7

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 16, 2026
Comment thread apps/web/src/components/ComposerPromptEditor.tsx
@yordis

yordis commented Jul 16, 2026

Copy link
Copy Markdown
Author
Screen.Recording.2026-07-16.at.5.12.58.AM.mov

Comment thread apps/web/src/components/ComposerPromptEditor.tsx
Comment thread apps/web/src/components/files/FileBrowserPanel.tsx
Comment thread apps/web/src/components/files/FileBrowserPanel.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces new user-facing features including file explorer context menu actions (copy mention, add to chat) and a paste handler that parses and converts mentions in pasted text. New capabilities affecting user interaction patterns warrant human review.

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

… from swallowing clipboard

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 718e283. Configure here.

Comment thread apps/web/src/components/ComposerPromptEditor.tsx
Comment thread apps/web/src/components/files/FileBrowserPanel.tsx Outdated
yordis added 2 commits July 16, 2026 13:34
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
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