-
Notifications
You must be signed in to change notification settings - Fork 2.4k
ctrl/cmd+click to navigate to files from textarea Closes #8144 #8111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
ctrl/cmd+click to navigate to files from textarea Closes #8144 #8111
Conversation
| .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>`, |
There was a problem hiding this comment.
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.
There was a problem hiding this 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):
- 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 onisMac, potentially causing multiple listeners to be attached. Consider using stable references with useRef or memoizing more effectively.
Important Suggestions (Should Consider):
-
Duplicate CSS rules in index.css: The
.mention-context-textarea-highlightclass 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. -
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.
-
Performance concern (line 810): The
updateHighlightsfunction 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):
-
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.
-
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.
-
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.
|
Hey @captjevans Thank you for the contribution, it seems like there are some failing unit tests, can you take a look? |
…ature/ctrl-click-on-files-in-chat-window
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
Screenshots / Videos
2025-09-17.17-01-44.1.mov
Documentation Updates
Additional Notes
Get in Touch
@jevons
Important
Adds feature to
ChatTextAreafor focusing on file mentions with@andCtrl/Cmd+Click, including event handling and styling updates.ChatTextAreato focus on file mentions using@andCtrl/Cmd+Click.ChatTextArea.tsxto track modifier key state..mention-context-textarea-highlightinindex.cssto support hover and clickable states.This description was created by
for d1fca3b. You can customize this summary. It will automatically update as commits are pushed.