Skip to content

Completion suggestion vs execution parity: option-value & option-region edges (follow-ups from #50) #54

Description

@carldebilly

Summary

Follow-ups from the review of #50 (interactive option-name completion). None is a regression — the pre-PR behavior offered none of these completions — and each is a suggestion vs execution parity edge in the option-value / option-region handling. Grouping them so #50 can merge.

1. Result-flow pending is case-sensitive (AutocompleteEngine IsPendingResultFlowOption)

Under OptionCaseSensitivity = CaseInsensitive, GlobalOptionParser accepts --RESULT:PAGE-SIZE and consumes the next token as the value, but the pending-value check only matches the lower-case constants. So --RESULT:PAGE-SIZE in can suggest install, which execution would consume as the page-size value. Fix: compare the result-flow tokens with the configured option case sensitivity.

2. --answer: missing from global option completions (OptionTokenCompletionSource)

The shared static global-option source omits the built-in --answer:<name>[=value] prefill (accepted by GlobalOptionParser.TryParsePromptAnswer, documented as a global flag). Typing --ans offers nothing. Fix: add --answer: alongside the other static tokens.

3. Context suggestions survive the option region (AutocompleteEngine)

#50 suppresses route command candidates once a terminal route carries trailing option tokens, but the context-candidate path is still called. With a parent route ([ReplOption] bool force) and a parent child context, parent --force c can offer child, which execution treats as the route's trailing option text rather than entering the context. Fix: suppress context candidates in the same option-region condition.

4. Pending value invokes the route's sole provider, not the pending option's (AutocompleteEngine)

#50 keeps the value provider for a pending option, but reuses the exact-route dynamic path that runs the route's single registered completion without checking which parameter it targets. For run {target} with a provider on target plus [ReplOption] string channel, run app --channel offers target values as channel values; with providers on both, the count is no longer one and nothing is offered. Fix: resolve the pending option's parameter and invoke only that parameter's provider.

Context

Not doing in #50

These are minor, no-regression parity refinements; #50 (the #43 feature) is merged/ready without them.

🤖 Generated with Claude Code

https://claude.ai/code/session_01H1Afor6vpDgWBQqTb95Sjd

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