Skip to content

Allow completion of parameters at the cursor for commands with dynamic parameters - #27743

Open
MartinGC94 wants to merge 3 commits into
PowerShell:masterfrom
MartinGC94:fixDynamicParamCompletion
Open

MartinGC94 wants to merge 3 commits into
PowerShell:masterfrom
MartinGC94:fixDynamicParamCompletion

Conversation

@MartinGC94

@MartinGC94 MartinGC94 commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

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 as Get-ChildItem C:\ and therefore consider -Path bound already.

PR Context

Fixes regression added in: #19510

PR Checklist

Copilot AI review requested due to automatic review settings July 28, 2026 14:47
@MartinGC94
MartinGC94 requested a review from a team as a code owner July 28, 2026 14:47
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@iSazonov Ilya (iSazonov) added CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log CL-Engine Indicates that a PR should be marked as an engine change in the Change Log and removed CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log labels Jul 29, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Review - Needed The PR is being reviewed label Sep 25, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants