Skip to content

Conversation

@j-east
Copy link

@j-east j-east commented Sep 18, 2025

Related GitHub Issue

@daniel-lxs
Closes #8144

Roo Code Task Context (Optional)

Description

functionality to focus on a file similar to ctrl+click in the debug window which will allow you to look at the files you add to context using @ . Goal is to make it easier to confirm context is useful before sending and also as a way to view specific methods or logic that you want Roo Code to focus on in the prompt.

Test Procedure

add context using @ and then ctrl/cmd+click to view the file in the editor.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • [ X] Self-Review: I have performed a thorough self-review of my code.
  • [ X] Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • [ X] Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

2025-09-17.17-01-44.1.mov

Documentation Updates

Additional Notes

Get in Touch

@jevons


Important

Adds feature to ChatTextArea for focusing on file mentions with @ and Ctrl/Cmd+Click, including event handling and styling updates.

  • Behavior:
    • Adds functionality to ChatTextArea to focus on file mentions using @ and Ctrl/Cmd+Click.
    • Detects modifier key (Cmd on Mac, Ctrl on others) to enable clickable mentions.
    • Sends message to VSCode to open mentioned file.
  • Event Handling:
    • Adds global keydown and keyup listeners in ChatTextArea.tsx to track modifier key state.
    • Adds click event listener to highlight layer for mention clicks.
  • Styling:
    • Updates .mention-context-textarea-highlight in index.css to support hover and clickable states.
    • Adds transition and pointer events for clickable mentions.

This description was created by Ellipsis for d1fca3b. You can customize this summary. It will automatically update as commits are pushed.

@j-east j-east requested review from cte, jr and mrubens as code owners September 18, 2025 01:00
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request UI/UX UI/UX related or focused labels Sep 18, 2025
.replace(mentionRegexGlobal, '<mark class="mention-context-textarea-highlight">$&</mark>')
.replace(
mentionRegexGlobal,
`<mark class="${mentionClass}" title="${isModifierPressed ? `${isMac ? "Cmd" : "Ctrl"} + Click to open` : `Hold ${isMac ? "Cmd" : "Ctrl"} + Click to open`}">$&</mark>`,
Copy link

Choose a reason for hiding this comment

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

Consider extracting the tooltip texts ('Cmd + Click to open' and 'Hold Cmd + Click to open') into translation keys using the translation function (t). Hardcoding these user‐facing texts may affect localization consistency.

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

Copy link

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I've reviewed the changes for adding Ctrl/Cmd+Click functionality to focus on file mentions. The feature works as described, but I found several issues that should be addressed:

Critical Issues (Must Fix):

  1. Memory leak risk in ChatTextArea.tsx (lines 229-256): The global event listeners for keydown/keyup are added in a useEffect that depends on [handleGlobalKeyDown, handleGlobalKeyUp]. These callbacks are recreated on every render due to their dependency on isMac, potentially causing multiple listeners to be attached. Consider using stable references with useRef or memoizing more effectively.

Important Suggestions (Should Consider):

  1. Duplicate CSS rules in index.css: The .mention-context-textarea-highlight class is defined twice - first at lines 382-387 (in the original file) and again at lines 433-456. The first definition should be removed to avoid confusion.

  2. Missing accessibility support: The feature only works with mouse clicks. Consider adding keyboard support (e.g., Enter key when focused with modifier) for better accessibility.

  3. Performance concern (line 810): The updateHighlights function is called on every input change and scroll event. For large text inputs, this could impact performance. Consider debouncing the updates.

Minor Improvements (Nice to Have):

  1. Inconsistent event handling: The click handler is added to the highlight layer div but only processes clicks on MARK elements. Consider using event delegation more efficiently.

  2. Incomplete command support (line 268): Commands are highlighted with the clickable class but the click handler only extracts the mention text without the leading slash. For commands, you might want to preserve the slash.

  3. Missing visual feedback: When hovering with the modifier key pressed, users might benefit from additional visual cues beyond just the cursor change.

Overall, this is a useful feature that enhances the user experience. With these issues addressed, it will be a solid addition to the codebase.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 18, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Sep 18, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 18, 2025
@j-east j-east closed this Sep 18, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Sep 18, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 18, 2025
@j-east j-east changed the title Feature/autoscroll to user edits Closes: #7938 ctrl/cmd+click to navigate to files from textarea Sep 18, 2025
@j-east j-east reopened this Sep 18, 2025
@github-project-automation github-project-automation bot moved this from Done to New in Roo Code Roadmap Sep 18, 2025
@github-project-automation github-project-automation bot moved this from Done to Triage in Roo Code Roadmap Sep 18, 2025
@hannesrudolph hannesrudolph added Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. and removed PR - Needs Preliminary Review labels Sep 18, 2025
@j-east j-east changed the title ctrl/cmd+click to navigate to files from textarea ctrl/cmd+click to navigate to files from textarea Closes #8144 Sep 18, 2025
@daniel-lxs
Copy link
Member

Hey @captjevans Thank you for the contribution, it seems like there are some failing unit tests, can you take a look?

@daniel-lxs daniel-lxs moved this from Triage to PR [Changes Requested] in Roo Code Roadmap Sep 22, 2025
@hannesrudolph hannesrudolph added PR - Changes Requested and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 22, 2025
@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Status: PR [Needs Prelim Review]

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] ctrl/cmd+click to navigate to file context in the textarea

3 participants