Skip to content

feat: unified @mention button in FileViewer (lines or whole file) - #352

Open
windli2018 wants to merge 1 commit into
agegr:mainfrom
windli2018:feat/file-viewer-mention
Open

feat: unified @mention button in FileViewer (lines or whole file)#352
windli2018 wants to merge 1 commit into
agegr:mainfrom
windli2018:feat/file-viewer-mention

Conversation

@windli2018

Copy link
Copy Markdown

What

The FileViewer (opened-file tab) tool bar now has a single @ mention button that works everywhere:

  • Selected lines in source mode → inserts a line-range mention @path#Lstart-Lend
  • Otherwise → inserts a whole-file mention @path

The button is always visible (previously the line-mention button only showed in source mode). Behavior follows the current selection — same @ icon, one entry point. A dynamic tooltip shows what will happen: "Mention selected lines (L12-L18)" vs "Insert path".

On mobile, after any mention the file panel/sidebar closes so the chat (with the inserted mention) is revealed — no need to manually navigate back.

Why

  • File mention (@path) was missing in FileViewer entirely (only the file explorer sidebar had it).
  • The existing line-mention button was source-mode-only and disabled without a selection, so it was hard to discover.
  • One button that adapts to context keeps the toolbar clean while covering both cases.

How

  • FileViewer: a unified mention button (onPointerDown preventDefault to preserve the selection through the click on touch devices). Click handler branches on selectedLineRange.
  • AppShell: pass onAtMention to FileViewer (reusing the existing handleAtMention); the three mention handlers now collapse the file panel + sidebar on mobile so the user lands back in the chat.

Notes

  • Line mention still requires onMentionLines (passed when the right panel is open); when it's absent the button falls back to whole-file mention — so the button is always useful.
  • No new i18n keys (reuses existing `files.insertPath` / `files.mention` / `i18n.mentionSelectedLines`).

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.

1 participant