Skip to content

Live-hint/menu value-domain awareness: valid values flagged invalid & invalid constrained values not flagged #56

Description

@carldebilly

Summary

Follow-up from the review of #55 (raised by autocarl, explicitly non-blocking). After #55 the interactive live hint no longer flags a pending option value as Invalid when the current token is one the parser would consume as a separate value (empty, a plain value, or a signed numeric literal). That is correct for free-form (string) options.

But for a constrained pending option — today an enum — a consumable but non-matching prefix now shows no candidate and no Invalid hint, even though execution will reject it.

Repro

app.Map("run", ([ReplOption] ProbeMode mode) => mode.ToString()); // enum { Debug, Release }
> run --mode Z   (Tab)
# no enum candidate (nothing starts with "Z") AND no "Invalid: Z" hint
# execution would reject Z (enum parse fails)

Contrast: run --channel --prod (dash-prefixed, not consumable) correctly keeps its Invalid hint, and run --channel alpha (free-form string) correctly suppresses it.

Why it is deferred

  • Purely a live-hint UX nicety — it does not change execution or completion-candidate correctness.
  • Getting it right means the hint has to know the option's value domain and whether the typed prefix can still reach a valid value. That generalizes beyond enums (regex/type-constrained parameters, providers that constrain their output), so it deserves its own design rather than an enum special-case.

Suggested direction

Carry the pending option's parameter (already resolved on the completion path) into hint construction, and only suppress the Invalid fallback when the option is genuinely unconstrained (or when the prefix can still complete to a valid value). Add interactive regression tests for: free-form value (no hint), dash-prefixed value (Invalid), enum non-matching prefix (Invalid), enum matching prefix (candidate shown).

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions