Skip to content

Regression: apostrophes in prompt prose disable subsequent @file completion #915

Description

@breedx

Summary

After 029ca24, an apostrophe in ordinary prompt prose can prevent a later @file token from offering completions.

For example, with target.py available in the current directory/index:

  • read @target offers target.py.
  • don't change @target offers no candidates.
  • it's in @target also offers no candidates.

The cursor is at the end of each prompt.

Expected behavior

A contraction in preceding prose should not prevent completion of a later attachment token. Quoted and escaped filenames should continue to work, and email addresses or prose following a completed attachment should not be treated as active references.

Reproduction and verification

Reproduced using the real FilePathCompleter.get_completions with an injected file-index snapshot containing target.py, with background indexing disabled to make the test deterministic:

  1. Set the current directory and the snapshot root to the same temporary directory.
  2. Set the indexed paths to ["target.py"].
  3. Request completions for Document("don't change @target") with the cursor at the end.
  4. Observe an empty list instead of a completion for target.py.

The same completer probe returns target.py at pre-change commit 370c8b4fb195ff1215f63d706b190455d2147ff2; it returns no candidates at 1d25d696 containing the change.

The parser itself also demonstrates the failure:

  • active_reference("read @target") returns ("target", 6).
  • active_reference("don't change @target") returns None.

This was verified through parser/completer calls on Linux, not a full interactive TUI test.

Likely cause

code_puppy/file_completion_tokens.py:25-26 treats every apostrophe or double quote in the entire preceding prompt as a quote delimiter. The apostrophe in don't opens quote state; subsequent spaces no longer advance the active token boundary, so the later @target is not recognized.

Please scope filename quote/escape handling to the active attachment token, or otherwise distinguish contractions in surrounding prose from quoted paths. Add regression coverage for contractions before @file, alongside the existing quoted/escaped-path and token-boundary tests.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions