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:
- Set the current directory and the snapshot root to the same temporary directory.
- Set the indexed paths to
["target.py"].
- Request completions for
Document("don't change @target") with the cursor at the end.
- 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.
Summary
After 029ca24, an apostrophe in ordinary prompt prose can prevent a later
@filetoken from offering completions.For example, with
target.pyavailable in the current directory/index:read @targetofferstarget.py.don't change @targetoffers no candidates.it's in @targetalso 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_completionswith an injected file-index snapshot containingtarget.py, with background indexing disabled to make the test deterministic:["target.py"].Document("don't change @target")with the cursor at the end.target.py.The same completer probe returns
target.pyat pre-change commit370c8b4fb195ff1215f63d706b190455d2147ff2; it returns no candidates at1d25d696containing the change.The parser itself also demonstrates the failure:
active_reference("read @target")returns("target", 6).active_reference("don't change @target")returnsNone.This was verified through parser/completer calls on Linux, not a full interactive TUI test.
Likely cause
code_puppy/file_completion_tokens.py:25-26treats every apostrophe or double quote in the entire preceding prompt as a quote delimiter. The apostrophe indon'topens quote state; subsequent spaces no longer advance the active token boundary, so the later@targetis 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.