Repository navigation
Keep a cursor on the executable out of argument completion - #144
Conversation
…letion With advanced input enabled, shell completion clamped a cursor before the argument region to the start of the arguments, then rebuilt the request with the cursor after the executable. A cursor inside or at the end of the executable token was therefore offered command candidates that plain completion never offers there. A cursor on the executable, its end included as plain completion counts it, now gets plain completion without running input callbacks: they only ever see the arguments. A cursor past it, even in the spaces before the arguments, still goes through adaptation and validation. Fixes #141
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
autocarl
left a comment
There was a problem hiding this comment.
Approved exact head 9745eb9a095add8c8f8540016a90ef3a9f051599.
The executable cursor guard fixes #141 while preserving argument-region validation. Independent unchanged-source differential probes cover all cursor offsets over 19 lines and all five supported shell-engine modes: 4,275 observations per revision on head, merge base and current base. Identity/Valid completion now matches plain completion; callbacks do not run before/on the executable, including its end; Invalid and throwing callbacks remain enforced past it. Quoted/incomplete executable forms, leading whitespace, argument boundaries and positive command-completion controls were covered. Parent reran the analysis and checked its assertions. No introduced P0–P2 found. These are bridge-engine probes, not a claim that every native shell UI was exercised.
Parent Release solution build with -warnaserror: zero warnings/errors; full suite 2,408 passed, 0 failed, 3 expected skips. All applicable live CI checks pass. Worktree clean; no merge performed.
Fixes #141.
What changes
Math.Max(0, cursor - start)), then rebuilt the request with the cursor after the executable. A cursor inside or at the end of the executable token was therefore offered command candidates (appat offset 1 offeredquery) where plain completion offers none. Such a cursor now gets plain completion, and input callbacks do not run for it: adapters and validators only ever see the arguments.appat offset 3). A cursor past it, even in the spaces before the arguments, still goes through adaptation and validation, so an Invalid result there still leaves nothing to complete.docs/advanced-input.mdsays the bridge answers a cursor on the executable as plain completion, without running callbacks.Verification
Given_AdvancedInput_ServiceAndCursor:When_AdvancedInputIsEnabled_Then_CompletionAroundTheExecutableMatchesPlainCompletion: ten cursor positions (before, inside and at the end of the executable, leading whitespace, the argument boundary, the separating spaces, after a partial command) in Bash, Zsh, PowerShell, Fish and Nu. Each compares an identity adapter and an always-valid validator against pinned plain completion.When_InputValidationRefusesTheArguments_Then_NothingPastTheExecutableIsCompleted: an always-invalid validator in the separating spaces and after them.When_TheCursorIsOnTheExecutable_Then_InputCallbacksDoNotRun: a throwing adapter is never invoked and writes no diagnostic.