ui-common: Show mention suggestions after non-alphanumeric dividers#6530
ui-common: Show mention suggestions after non-alphanumeric dividers#6530gpunto wants to merge 1 commit into
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
WalkthroughThe TypingSuggester Trigger Validation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/typing/TypingSuggesterTest.kt (1)
48-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a digit-adjacent negative case.
The new contract is “not attached to a letter or digit”, but these additions only lock down punctuation and letter/email cases. A case like
1@johnorroom2@johnreturningnullwould keep theisDigit()half of Line 45 covered.Suggested test addition
Arguments.of("Hello@john", null), + Arguments.of("1@john", null), Arguments.of("`@john`,`@jane`", TypingSuggestion("jane", 7 until 11)), Arguments.of("`@john`, `@jane`", TypingSuggestion("jane", 8 until 12)), Arguments.of("(`@john`", TypingSuggestion("john", 2 until 6)),🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/typing/TypingSuggesterTest.kt` around lines 48 - 51, Add a new negative test case in TypingSuggesterTest to cover the “not attached to a letter or digit” contract for TypingSuggester.suggestTypingSuggestion. Extend the existing parameterized data near the current email and punctuation cases with an input like 1@john or room2@john that must return null, so the isDigit() branch in the typing-suggestion boundary check is explicitly covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/typing/TypingSuggesterTest.kt`:
- Around line 48-51: Add a new negative test case in TypingSuggesterTest to
cover the “not attached to a letter or digit” contract for
TypingSuggester.suggestTypingSuggestion. Extend the existing parameterized data
near the current email and punctuation cases with an input like 1@john or
room2@john that must return null, so the isDigit() branch in the
typing-suggestion boundary check is explicitly covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 52141207-2fc2-40ae-8b9f-0baf840a45e3
📒 Files selected for processing (2)
stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/typing/TypingSuggester.ktstream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/typing/TypingSuggesterTest.kt
|



Goal
Typing a mention right after a comma (e.g.
@john,@jane) did not reveal suggestions for the second mention.TypingSuggesteronly accepted the@symbol at the start of the input or after whitespace, so any non-whitespace divider in front of it was rejected.Reported during QA: Android QA - Mentions
Closes AND-1276
Implementation
TypingSuggesternow accepts the symbol unless it is glued directly to a letter or digit. This covers commas and other separators (punctuation, brackets) while still rejecting cases likeHello@johnand email addresses (john@example.com).Testing
TypingSuggesterTestcases: comma-divided mentions (@john,@jane), a bracket divider ((@john), and an email that must not trigger (john@example.com).Summary by CodeRabbit