Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 10, 2025

Description

Added [ArgumentCompleter] attribute to the $Configuration parameter in tools/BuildScripts/BuildModules.ps1 to enable tab completion for configuration options.

Changes:

  • Added [ArgumentCompleter] with script block to provide tab completion for "Debug" and "Release" values

Impact:

  • Tab completion now works: -Configuration <TAB> shows Debug/Release options
  • More flexible than ValidateSet - allows future expansion of configuration options without code changes
  • IntelliSense support in IDEs (VS Code, PowerShell ISE)
  • Does not enforce strict validation, allowing custom configuration values if needed

Implementation:

[ArgumentCompleter({
    param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
    @('Debug', 'Release') | Where-Object { $_ -like "$wordToComplete*" }
})]
[string]$Configuration = 'Debug',

Key Difference from ValidateSet:

  • ArgumentCompleter: Provides tab completion suggestions but allows any value (flexible)
  • ValidateSet: Enforces strict validation and rejects invalid values (restrictive)

Example:

# Valid usage with tab completion
./tools/BuildScripts/BuildModules.ps1 -Configuration Debug -TargetModule Accounts
./tools/BuildScripts/BuildModules.ps1 -Configuration Release -TargetModule Storage

# Tab completion: -Configuration <TAB> shows Debug, Release

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request
Original prompt

Add an argument completer to the parameter $Configuration of the powershell script tools/BuildScripts/BuildModules.ps1, containing two values "Debug" and "Release".


💡 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.

@azure-client-tools-bot-prd
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Co-authored-by: isra-fel <11371776+isra-fel@users.noreply.github.com>
Copilot AI changed the title [WIP] Add argument completer for $Configuration parameter Add ValidateSet argument completer to Configuration parameter in BuildModules.ps1 Nov 10, 2025
Copilot AI requested a review from isra-fel November 10, 2025 00:39
Copilot finished work on behalf of isra-fel November 10, 2025 00:39
@isra-fel
Copy link
Member

Please make it an argument completer instead of validateset because there might be more options. @copilot

Co-authored-by: isra-fel <11371776+isra-fel@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 10, 2025

Please make it an argument completer instead of validateset because there might be more options. @copilot

Changed to ArgumentCompleter in commit c387de4. This provides tab completion for "Debug" and "Release" while allowing future expansion of configuration options without requiring code changes to the validation logic.

Copilot AI changed the title Add ValidateSet argument completer to Configuration parameter in BuildModules.ps1 Add ArgumentCompleter to Configuration parameter in BuildModules.ps1 Nov 10, 2025
Copilot finished work on behalf of isra-fel November 10, 2025 01:32
@isra-fel isra-fel added this to the Az 15.1.0 (12/02/2025) milestone Nov 10, 2025
@isra-fel isra-fel marked this pull request as ready for review November 10, 2025 05:50
Copilot AI review requested due to automatic review settings November 10, 2025 05:50
Copy link
Contributor

Copilot AI left a comment

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 adds tab completion support for the Configuration parameter in the BuildModules.ps1 script to improve developer experience when building modules.

  • Adds an ArgumentCompleter attribute to the Configuration parameter
  • Provides autocomplete suggestions for 'Debug' and 'Release' configuration values

[string]$RepoRoot,
[ArgumentCompleter({
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
@('Debug', 'Release') | Where-Object { $_ -like "$wordToComplete*" }
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

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

The -like operator is case-sensitive in PowerShell. This means tab completion won't work if a user types lowercase text like "deb" or "rel". Consider using the case-insensitive -ilike operator instead to provide a better user experience:

@('Debug', 'Release') | Where-Object { $_ -ilike "$wordToComplete*" }
Suggested change
@('Debug', 'Release') | Where-Object { $_ -like "$wordToComplete*" }
@('Debug', 'Release') | Where-Object { $_ -ilike "$wordToComplete*" }

Copilot uses AI. Check for mistakes.
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.

2 participants