Skip to content

fix(nushell): switch wrapper to @complete attribute on untyped rest#2458

Merged
max-sixty merged 1 commit intomainfrom
nushell
Apr 29, 2026
Merged

fix(nushell): switch wrapper to @complete attribute on untyped rest#2458
max-sixty merged 1 commit intomainfrom
nushell

Conversation

@max-sixty
Copy link
Copy Markdown
Owner

Per fdncred's recommendation in nushell/nushell#18128, replaces the parameter-level [...args: string@\"nu-complete wt\"] with a function-level @complete attribute on an untyped [...args] rest. The completer signature moves from [context: string] (with manual split row \" \" reconstruction) to [spans: list<string>], which nushell pre-tokenizes — net deletion of seven lines of fragile token reassembly.

Untyped rest is the form nushell routes through its normal external-argument handling, so once nushell/nushell#18131 ships in stable nu the wrapper will automatically benefit from --flag=\"value\" quote stripping and ~ expansion without further changes. Until then --flag=\"value\" still arrives at the binary with literal quotes — a pre-existing bug, not a regression introduced here. Supersedes #2437 (the body-level regex strip workaround).

Test plan

  • cargo test --test integration --features shell-integration-tests — 1717 passed (including all four nu wrapper cases)
  • pre-commit run --all-files — clean
  • Smoke-tested the rendered template parses cleanly under nu 0.112.1
  • Hand-verify subcommand completion at trailing space (e.g. wt switch <TAB>) in an interactive nu session — couldn't drive reedline via PTY in test, but fdncred's example in Parity with bare external tokenization for --wrapped / extern rest args (--flag="value") nushell/nushell#18128 implies spans is populated at the cursor position

Ref nushell/nushell#18128, nushell/nushell#18131

Per fdncred's recommendation in nushell/nushell#18128, replaces the
parameter-level `[...args: string@"nu-complete wt"]` with a function-level
`@complete` attribute on an untyped `[...args]` rest. The completer signature
moves from `[context: string]` (with manual `split row " "` reconstruction) to
`[spans: list<string>]`, which nushell pre-tokenizes — net deletion of seven
lines of fragile token reassembly.

Untyped rest is the form nushell routes through its normal external-argument
handling, so once nushell/nushell#18131 ships in stable nu the wrapper will
automatically benefit from `--flag="value"` quote stripping and `~` expansion
without further changes. Until then `--flag="value"` still arrives at the
binary with literal quotes — a pre-existing bug, not a regression introduced
here. This change supersedes PR #2437 (the body-level regex strip workaround).

Co-Authored-By: Claude <noreply@anthropic.com>
@max-sixty max-sixty merged commit fdc6df6 into main Apr 29, 2026
26 checks passed
@max-sixty max-sixty deleted the nushell branch April 29, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants