Skip to content

fix(completion): filter PowerShell completions by prefix - #4721

Merged
max-sixty merged 1 commit into
max-sixty:mainfrom
Bortlesboat:fix/powershell-completion-prefix
Nov 6, 2026
Merged

max-sixty merged 1 commit into
max-sixty:mainfrom
Bortlesboat:fix/powershell-completion-prefix

Conversation

@Bortlesboat

Copy link
Copy Markdown
Contributor

In PowerShell, wt switch feat<Tab> replaces feat with whichever branch is listed first (e.g. main) instead of a branch starting with feat. The value completers return every candidate so fish and zsh can do their own matching, and only bash gets a prefix filter (#1622), but clap's PowerShell completer doesn't filter on the typed word either. This applies the existing filter for COMPLETE=powershell too, and the cross-shell filtering contract test now covers powershell. Ran cargo test --test integration -- completion::, and checked TabExpansion2 with the shell integration loaded in pwsh 7.6.9 and Windows PowerShell 5.1.

Value completers (branches, worktrees, hook and alias names) return every
candidate so fish and zsh can apply their own matching, and
maybe_handle_env_completion() prefix-filters the result only for bash.
PowerShell needs the same filter: clap's native completer wraps each
returned line in a CompletionResult without checking the typed word, so
`wt switch feat<Tab>` offered every branch and Tab replaced `feat` with
whichever candidate came first (e.g. `main`).

Apply the existing prefix filter when COMPLETE=powershell too, and extend
the cross-shell filtering contract test to cover it.
@max-sixty
max-sixty merged commit 6fdb42a into max-sixty:main Nov 6, 2026
37 checks passed
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.

3 participants