Skip to content

fix: mention ping detection#926

Open
beladiyaraj wants to merge 6 commits intopingdotgg:mainfrom
beladiyaraj:fix/issue-876-thread-sync
Open

fix: mention ping detection#926
beladiyaraj wants to merge 6 commits intopingdotgg:mainfrom
beladiyaraj:fix/issue-876-thread-sync

Conversation

@beladiyaraj
Copy link

@beladiyaraj beladiyaraj commented Mar 11, 2026

What Changed

Fixed @ file/folder mentions in the message box.

  1. Fixed the issue where @ mentions only worked at the end of the message.
  2. Fixed the issue where adding one file mention could break a later @ mention in the same message.
  3. Fixed the issue where typing a new @ could show old search results from the previous mention for the same message.
  4. Improved the logic so file suggestions follow the actual cursor position more reliably when editing text around existing mentions.
  5. Added regression tests for the broken mention flows we found.

Why

Previously:

  • @ mentions could behave differently depending on where they were typed in the sentence.
  • After selecting one file, going back and typing another @ could fail or behave inconsistently.
  • A fresh @ could show stale results from the previous search instead of starting clean for the same message.

Now:

  • @ mentions work more reliably anywhere in the message.
  • Multiple mentions in the same message behave correctly.
  • A new @ starts from a clean suggestion state and only shows current matches.

UI Changes

None

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

This PR fixes the issue #857

Note

Fix mention ping detection using expanded cursor in composer trigger resolution

  • Introduces detectComposerTriggerFromSnapshot in composer-logic.ts, which prefers expandedCursor when available (falling back to expanding the collapsed cursor) before calling detectComposerTrigger.
  • Adds mode-aware ('collapsed' | 'expanded') cursor measurement to getComposerNodeTextLength, getAbsoluteOffsetForPoint, and $readSelectionOffsetFromEditorState in ComposerPromptEditor.tsx so mention nodes contribute their full text length in expanded mode.
  • The editor now tracks both a collapsed and expanded cursor position, passing nextExpandedCursor to the active pending user input answer callback.
  • Adds resolveComposerPathMenuEntries in composer-path-menu.ts to hide path suggestions when the query is empty or while debouncing/fetching/loading.
  • Behavioral Change: @path mention trigger detection now uses the expanded cursor position, which may change which trigger is detected when the cursor is adjacent to a mention node.

Macroscope summarized e1458c8.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5c62cede-96dd-409d-9011-bf464277e8f9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Tip

CodeRabbit can generate a title for your PR based on the changes.

Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the reviews.auto_title_placeholder setting.

@github-actions github-actions bot added the vouch:unvouched PR author is not yet trusted in the VOUCHED list. label Mar 11, 2026
@juliusmarminge
Copy link
Member

conflicts

@juliusmarminge juliusmarminge added the accepted feature request accepted label Mar 12, 2026
@juliusmarminge
Copy link
Member

@macroscope-app review this

@github-actions github-actions bot added the size:L 100-499 changed lines (additions + deletions). label Mar 12, 2026
@juliusmarminge
Copy link
Member

bug with cursor moving to the end when inserting a mention at the start:
https://github.com/user-attachments/assets/6cf8108e-f3ea-419d-8012-30208fcc9757

@beladiyaraj
Copy link
Author

bug with cursor moving to the end when inserting a mention at the start: https://github.com/user-attachments/assets/6cf8108e-f3ea-419d-8012-30208fcc9757

Let me fix this

@juliusmarminge
Copy link
Member

conflcits

@beladiyaraj
Copy link
Author

beladiyaraj commented Mar 14, 2026

Hey @juliusmarminge i think this has been fixed in the commit 71a7473

so we can close this without merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accepted feature request accepted size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants