Skip to content

Composer @file autocomplete should work in the middle of an existing prompt #922

@dpshade

Description

@dpshade

Problem

The composer @<file> autocomplete is unreliable when the mention is started in the middle of an existing prompt that already has text after the cursor.

In practice, this makes prompt editing awkward because the file/dir autocomplete UI often only appears or behaves correctly when the @ mention is effectively at the end of the input. Users may need to delete the text after the cursor, insert the file mention, and then retype the deleted text.

Repro

  1. Type a normal prompt with text both before and after the cursor.
  2. Move the cursor into the middle of that prompt.
  3. Type @ and start searching for a file or directory.
  4. Observe that the autocomplete UI does not reliably appear or function correctly unless trailing text is removed first.

Example shape:

Please inspect @ in this sentence and summarize the result for me later.

Move the cursor after inspect and try to insert a file mention without deleting in this sentence and summarize the result for me later.

Expected

  • File/dir autocomplete should work regardless of whether there is trailing text after the cursor
  • Users should be able to insert an @file mention in the middle of a prompt without deleting surrounding text
  • Selection should preserve the surrounding prompt text and place the caret in the expected position afterward

Actual

  • Mid-prompt @file completion is unreliable when text exists after the cursor
  • Editing a prompt to add file references becomes cumbersome because users may need to delete and retype trailing text

Notes

This appears related to existing composer mention/cursor handling issues, including #291, but this issue specifically tracks the inability to reliably use file mention autocomplete in the middle of an existing prompt with trailing text still present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions