Repository navigation
fix(completion): filter PowerShell completions by prefix - #4721
Merged
max-sixty merged 1 commit intoNov 6, 2026
Merged
Conversation
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.
worktrunk-bot
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In PowerShell,
wt switch feat<Tab>replacesfeatwith whichever branch is listed first (e.g.main) instead of a branch starting withfeat. 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 forCOMPLETE=powershelltoo, and the cross-shell filtering contract test now covers powershell. Rancargo test --test integration -- completion::, and checkedTabExpansion2with the shell integration loaded in pwsh 7.6.9 and Windows PowerShell 5.1.