-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix @ mention triggering mode menu on @/ #2696
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
Fix @ mention triggering mode menu on @/ #2696
Conversation
Commit Body: Fixes a bug where typing @/ opened the mode selection menu instead of file/folder suggestions. Changes: Skip mode selection if context is File or Folder Normalize paths (add leading /) for better fuzzy matching Force File type when @/ is detected in input Fixes RooCodeInc#2660
| if (query.length > 0) { | ||
| // Check if the query is valid for initiating a file search | ||
| // It should have length > 0 AND not be just '/', '.', or '\' immediately after @ | ||
| const isValidSearchQuery = query.length > 0 && !/^[/.\\\\]$/.test(query) // Removed \ before / and . |
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.
Clarify the regex pattern used for isValidSearchQuery. The comment 'Removed \ before / and .' might be confusing. Consider explaining what cases it handles, or extract this pattern as a named constant for clarity.
| const isValidSearchQuery = query.length > 0 && !/^[/.\\\\]$/.test(query) // Removed \ before / and . | |
| const isValidSearchQuery = query.length > 0 && !/^[/.\\]$/.test(query) // Excludes queries that are only '/', '.', or '\' after @ mention; prevents invalid file searches. |
|
@mrubens check this out! |
|
Thanks for finding this! |
|
What do you think of this as a simpler approach? With the commands we have I think they only make sense at the beginning of the input, which lets us simplify a bit. #2702 |
|
I went with ☝️ since the code was a little simpler, but thank you for the contribution and figuring out the problem! |
Yes, that makes sense, simpler and more general approach. Thank you for taking the time to review. |
Fix
@/triggering mode menu instead of file/folder suggestionsFixes: #2660
Bug
Typing
@/incorrectly opened the mode selection menu instead of showing file or folder suggestions.Changes
FileorFolder/to improve fuzzy matchingFilecontext when input starts with@/Context
The
/in@/was misinterpreted as a slash command trigger. This caused the mode menu to appear instead of showing relevant file suggestions. The fix ensures correct behavior by enforcing the appropriate context and improving path handling.Implementation
selectedType = Filewhen detecting@/getContextMenuOptionsto bypass mode logic when type isFileorFolder/before fuzzy matchingHow to Test
@/in the mention input field.Contact
Discord:
@logostoneOr comment directly in this pull request.
Important
Fix
@/triggering mode menu by enforcingFilecontext and normalizing paths inChatTextArea.tsxandcontext-mentions.ts.@/triggering mode menu instead of file/folder suggestions.Filecontext when input starts with@/inChatTextArea.tsx./incontext-mentions.tsfor better matching.getContextMenuOptions()to skip mode logic forFileorFoldertypes.shouldShowContextMenu()to correctly handle@/input.handleInputChange()inChatTextArea.tsxto validate search queries and set default menu index.This description was created by
for 30c1c86. It will automatically update as commits are pushed.