[BUG] Tab completion on single-match file with @ in path repeatedly prepends directory prefix
Bug Description
When using @ file mention autocomplete, if the completed file path contains an @ character and the search matches exactly one file, pressing Tab after the initial completion does not dismiss the autocomplete dropdown. Instead, each subsequent Tab press prepends the parent directory to the input, creating an infinitely growing path.
Steps to Reproduce
- Have a file whose path contains
@— e.g.,.ralph/@fix_plan.md - In the input prompt, type
@fix_plan(specific enough to match exactly one file) - The autocomplete dropdown shows
+ .ralph/@fix_plan.md - Press Tab to accept — input becomes
@.ralph/@fix_plan.md✓ - The autocomplete dropdown does not dismiss
- Press Tab again — input becomes
@.ralph/@.ralph/@fix_plan.md✗ - Each additional Tab press prepends another
.ralph/
Expected Behavior
After step 4, the autocomplete should dismiss (or a second Tab should insert a space and dismiss it, which is the current behavior for files without @ in the path).
Actual Behavior
The @ within the filename is re-interpreted as a new file-reference trigger. Since @fix_plan.md still matches the same single file, each Tab press "completes" it again by prepending .ralph/.
| Tab press | Input |
|-----------|-------|
| 0 (before) | @fix_plan |
| 1 | @.ralph/@fix_plan.md |
| 2 | @.ralph/@.ralph/@fix_plan.md |
| 3 | @.ralph/@.ralph/@.ralph/@fix_plan.md |
Screenshots
Before Tab
<img width="1512" height="982" alt="Image" src="https://github.com/user-attachments/assets/46474f35-a071-4629-b39a-69abb5b1621e" />
First Tab press
<img width="1512" height="982" alt="Image" src="https://github.com/user-attachments/assets/6ceaf226-9fc4-41c1-8206-a6d39662f79b" />
Second Tab press
<img width="1512" height="982" alt="Image" src="https://github.com/user-attachments/assets/2025e29d-7b01-4c41-a3ed-8ccf207bde03" />
Third Tab press
<img width="1512" height="982" alt="Image" src="https://github.com/user-attachments/assets/881f6964-b0cf-4024-846d-4805dd129c65" />
Additional Context
- Only reproduces when the search text matches exactly one file (single-match triggers auto-accept on Tab)
- Does not reproduce with files that have no
@in their path — for those, a second Tab correctly dismisses the dropdown - Workaround: press Space or Escape instead of Tab to dismiss the dropdown after the first completion
Environment
- Claude Code CLI (terminal, not VS Code extension)
- macOS (Warp terminal)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗