Repository navigation
Allow completion of parameters at the cursor for commands with dynamic parameters - #27743
Open
MartinGC94 wants to merge 3 commits into
Open
MartinGC94 wants to merge 3 commits into
MartinGC94 wants to merge 3 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a regression in tab completion for commands that implement dynamic parameters by ensuring the “parameter at cursor” is only excluded from pseudo-binding when it is not a (static) parameter of the command. This prevents pseudo-binding from shifting parameter sets or positional bindings in ways that incorrectly suppress parameter completions (e.g., Get-ChildItem -Path<Tab> C:\).
Changes:
- Refines pseudo-binding filtering so the parameter at the cursor is not skipped if it is a static parameter.
- Adds a Pester test covering completion of a static parameter at the cursor for a command with dynamic parameters.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 | Adds a regression test to validate parameter completion at the cursor for Get-ChildItem. |
| src/System.Management.Automation/engine/CommandCompletion/PseudoParameterBinder.cs | Updates pseudo-binder logic to avoid skipping the cursor parameter when it is a known static parameter. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Ilya (iSazonov)
approved these changes
Jul 29, 2026
Contributor
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
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.
PR Summary
This PR: #19510 made it so the parameter at the cursor is not included in the pseudobinding process for commands with dynamic parameters. This new PR adds an additional check so the parameter is only excluded if it doesn't exist in the list of static parameters.
This fixes an issue where you sometimes couldn't complete a parameter at the cursor if this filtering resulted in a different parameterset, or a positional binding that excluded the parameter. For example this:
Get-ChildItem -Path<Tab> C:\did not work because the pseudobinding would see it asGet-ChildItem C:\and therefore consider -Path bound already.PR Context
Fixes regression added in: #19510
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header