[PSS 2015] Renaming variables: Parameter

Post feature requests, product enhancement ideas, and other product-specific suggestions here. Do not post bug reports.
Forum rules
Do not post any licensing information in this forum.
This topic is 8 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
Bosparan
Posts: 290
Last visit: Fri Oct 08, 2021 11:59 am

[PSS 2015] Renaming variables: Parameter

Post by Bosparan »

Hi guys,

another small request, to make a features that already exists work more smoothly:

When renaming the parameter of a function, could you also rename ...
... $PSBoundParameters entries?
... Examples in the Help section?
... Parameter documentation in the Help section?

Example of current State
Before Rename
  1. function Get-Test
  2. {
  3.     <#
  4.         .SYNOPSIS
  5.             A brief description of the Get-Test function.
  6.        
  7.         .DESCRIPTION
  8.             A detailed description of the Get-Test function.
  9.        
  10.         .PARAMETER Foo
  11.             A description of the Foo parameter.
  12.        
  13.         .EXAMPLE
  14.             PS C:\> Get-Test -Foo $value1
  15.        
  16.         .NOTES
  17.             BlaBla
  18.        
  19.         .LINK
  20.             Link to Website.
  21.     #>
  22.     [CmdletBinding()]
  23.     Param (
  24.         $Foo
  25.     )
  26.    
  27.     if ($PSBoundParameters['Foo'])
  28.     {
  29.        
  30.     }
  31. }
After Rename
  1. function Get-Test
  2. {
  3.     <#
  4.         .SYNOPSIS
  5.             A brief description of the Get-Test function.
  6.        
  7.         .DESCRIPTION
  8.             A detailed description of the Get-Test function.
  9.        
  10.         .PARAMETER Foo
  11.             A description of the Foo parameter.
  12.        
  13.         .EXAMPLE
  14.             PS C:\> Get-Test -Foo $value1
  15.        
  16.         .NOTES
  17.             BlaBla
  18.        
  19.         .LINK
  20.             Link to Website.
  21.     #>
  22.     [CmdletBinding()]
  23.     Param (
  24.         $Bar
  25.     )
  26.    
  27.     if ($PSBoundParameters['Foo'])
  28.     {
  29.        
  30.     }
  31. }
Cheers,
Bosparan
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: [PSS 2015] Renaming variables: Parameter

Post by davidc »

The $PSBoundParameters reference will be picked up if you use the ContainsKey method. We will make sure it also picks up the indexing operator as well in the next build.

Updating the comment-based help is on our list of wanted features.

David
David
SAPIEN Technologies, Inc.
This topic is 8 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked