Skip to content

feat(emoji): rank completions by word start and match emoji keywords - #334

Open
matheusfillipe wants to merge 2 commits into
mainfrom
feat/emoji-word-completion
Open

matheusfillipe wants to merge 2 commits into
mainfrom
feat/emoji-word-completion

Conversation

@matheusfillipe

@matheusfillipe matheusfillipe commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

:rol<Tab> offered control_knobs first, because emoji completion matched any substring of the short name in dataset order. Words that are not in a short name, like turd for 💩 or eyeroll for 🙄, found nothing.

  • Results are ranked: exact name, name prefix, a word in the name (rol hits face_with_rolling_eyes), an emoji keyword, then plain substring last. Ties go to the shorter name.
  • Keywords come from the emoji-picker-react data we already ship, joined onto the completion data at build time.
  • :+1 and :100 complete. A shortcode starts at the start of the line or after a space, so times like 12:30 and host:8080 stay text and Tab falls through to nicks.
flowchart LR
  Q[":rol + Tab"] --> A[exact] --> B[prefix] --> C[word start] --> D[keyword] --> E[substring]
Loading

Summary by CodeRabbit

  • New Features
    • Emoji search now matches keywords and ranks results by relevance, prioritizing exact names and stronger matches.
    • Shortcodes can include digits and symbols such as + and -. Suggestions can start at the beginning of input or after a non-word, non-colon character, including immediately after an emoji.
  • Bug Fixes
    • Colons in times and repeated colons no longer trigger emoji suggestions.
    • Empty queries return no results, and suggestions respect the result limit.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: edd54c35-e68f-4f12-8179-bbf7da6e0e11
Commits

Reviewing files that changed from the base of the PR and between ab5d337 and 7745d78.

Files selected for processing: 2
  • src/components/chat/completionProviders.tsx
  • tests/components/chat/completionProviders.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

Emoji completion data now includes keywords. A ranking function orders emoji matches by match type, name length, and input order. The chat completion provider uses this ranking for shortcode queries and limits the returned results.

Changes: Emoji completion search

Layer / File(s) Summary
Emoji keyword data
src/vite-env.d.ts, vite.config.ts, src/components/chat/completionProviders.tsx
Slim emoji records now include keywords from the emoji picker data. The completion item type and conversion include those keywords.
Emoji ranking
src/lib/emojiSearch.ts, tests/lib/emojiSearch.test.ts
rankEmojis ranks exact names, prefixes, word starts, keyword word starts, and name substrings. Tests cover ranking, case handling, empty queries, and result limits.
Chat completion integration
src/components/chat/completionProviders.tsx, tests/components/chat/completionProviders.test.tsx
The provider matches shortcode queries at the start of input or after a non-word, non-colon character. It accepts word characters, +, and - in the query and uses rankEmojis with the MAX_EMOJIS limit. Tests cover signed numeric queries, rejected colon placements, and completion immediately after an emoji.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ViteConfig
  participant EmojiSlimData
  participant CompletionProvider
  participant RankEmojis
  ViteConfig->>EmojiSlimData: Add picker keywords to slim emoji records
  EmojiSlimData->>CompletionProvider: Provide emoji names and keywords
  CompletionProvider->>RankEmojis: Rank shortcode query with MAX_EMOJIS limit
  RankEmojis-->>CompletionProvider: Return ranked emoji matches
Loading
Merge Risk: Minimal · up to 7745d

The emoji completion changes have no identified merge-blocking issue and are mergeable subject to normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main changes: emoji completion ranking and keyword matching.
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

Pages Preview
Preview URL: https://feat-emoji-word-completion.obsidianirc.pages.dev

Automated deployment preview for the PR in the Cloudflare Pages.

@ValwareIRC

Copy link
Copy Markdown
Contributor

I'd prefer it if we didn't need a space after the first emoji before being able to :emoji another emoji, what do you think?

👍:emoji<tab> doesn't currently work (with no space after the first emoji)

@matheusfillipe
matheusfillipe force-pushed the feat/emoji-word-completion branch from ab5d337 to 7745d78 Compare October 30, 2026 10:23
@matheusfillipe

Copy link
Copy Markdown
Contributor Author

I'd prefer it if we didn't need a space after the first emoji before being able to :emoji another emoji, what do you think?

done

This branch has not been deployed

No deployments
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.

2 participants