fix(completion): apostrophes in prose no longer hide later @file refs - #916
fix(completion): apostrophes in prose no longer hide later @file refs#91612britz wants to merge 1 commit into
Conversation
active_reference treated every quote character in the prompt as a delimiter, so the apostrophe in contractions like "don't" opened quote state, swallowed subsequent whitespace, and left later @tokens unrecognized (issue mpfaffenberger#915). Quotes now only open a quoted span at a word boundary or immediately after the attachment symbol — the two places a filename is legitimately quoted. Quoted/escaped paths and closed-quote suppression keep their 029ca24 semantics. Also updates test_tilde_prefix_display, which still asserted unquoted insertion text and failed on main since 029ca24 quotes paths via shlex.quote. Fixes mpfaffenberger#915 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
Thanks for picking up #915! I confirmed that 38d3ba7 fixes the contractions from our report. The two changed test files pass locally (57 tests), and Ruff lint/format checks pass for all three changed files. I found one compatibility regression worth addressing before merge: the new quote-opening restriction also applies inside an active attachment path. With
I reproduced this through the real Could we preserve shell-style quote handling within an active attachment token while ignoring apostrophes in preceding prose, and add both partially quoted path cases to the regression tests? The contraction fix itself is working; this is a narrow compatibility edge to retain alongside it. Validation was on Linux through parser/completer calls and the focused tests, not a full interactive TUI run. |
Fixes #915
Summary
Since 029ca24, an apostrophe anywhere in the prompt could disable later
@filecompletion:don't change @targetoffered no candidates whileread @targetworked.active_reference()treated every'/"in the prompt as a quote delimiter, so the contraction opened quote state, subsequent whitespace stopped advancing the active-token boundary, and the later@tokenwas never recognized.Fix
A quote character now opens a quoted span only where a filename is legitimately quoted:
@"my file)A quote embedded inside a word — the apostrophe in
don't,it's— is ordinary prose and never opens quote state.Quoted/escaped path semantics from 029ca24 are preserved:
@"my file.txt,@'my file,@my\ file.txtstill complete, and@"my file.txt" donestill returns no active reference so trailing prose is never replaced.Also fixes a failing test on main
tests/test_completions_and_small_modules.py::TestFilePathCompleterMissedLines::test_tilde_prefix_displaycurrently fails onmain: it asserts insertion text starts with~, but 029ca24 quotes inserted paths viashlex.quote(its own regression test assertsshlex.split(inserted)parses back). Updated it to decode viashlex.splitbefore asserting the tilde-prefixed path.Test plan
tests/command_line/test_file_completion_regressions.py: contractions before@file(don't,it's,can't,they're,isn't), quote grouping, closed-quote suppressionuv run pytest tests/command_line/ tests/messaging/test_completion_stable_popup.py tests/messaging/test_editor_completion.py tests/plugins/test_completion_provider.py tests/test_completions_and_small_modules.py— 1062 passedruff check+ruff formatclean