🩹 [Patch]: Prevent ArgumentCompleters from falling back to the default file path completion #515
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.
This PR addresses an issue where PowerShell argument completers would fall back to file path completion when no valid argument matches were found, leading to irrelevant file and folder suggestions.
Problem
When using argument completion with GitHub PowerShell module commands, if no matches were found for the typed input, PowerShell would default to showing file and folder completions from the current directory. This created a confusing user experience where typing something like:
Would show local files and folders instead of no completions, suggesting invalid options to the user.
Solution
Updated all 34 argument completers across 14 files to explicitly return
$null
when no matches are found. The fix follows this pattern:Before:
After:
Result
This provides a cleaner, more intuitive completion experience that doesn't suggest invalid options to users.
Files Modified
All completer files throughout the module structure:
/src/completers.ps1
/src/functions/public/*/completers.ps1
Fixes #514.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.