Skip to content

Fix autocomplete targeting between mentions#30463

Draft
charliemarsh-oai wants to merge 4 commits into
mainfrom
charlie/fix-skill-autocomplete
Draft

Fix autocomplete targeting between mentions#30463
charliemarsh-oai wants to merge 4 commits into
mainfrom
charlie/fix-skill-autocomplete

Conversation

@charliemarsh-oai

@charliemarsh-oai charliemarsh-oai commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

When the cursor is on separator whitespace between an unbound skill mention and an already bound mention, we previously preferred the token to the right. For example, with | representing the cursor:

$unbound-skill | $bound-skill continue

The popup should target $unbound-skill, but it could instead resolve $bound-skill, whose text is already an atomic element. The insertion paths also rediscovered token boundaries independently, which made it possible for lookup and replacement to disagree.

The token lookup now returns the editable token's byte range, and the skill, file, and image insertion paths consume that range directly. This replaces exactly the token that opened the popup while preserving neighboring mention bindings and text elements.

When completion reuses existing whitespace, we also place the cursor after the separator:

Before: $unbound-skill|  $bound-skill continue
After:  $unbound-skill | $bound-skill continue

This prevents subsequent typing from producing $unbound-skillfoo .... The full chat-composer test suite passes.

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.

1 participant