Rich IntelliSense for Function Arguments

by Nov 15, 2012

To take advantage of the new PowerShell 3.0 argument completion, make sure you're adding ValidateSet attribute to your function parameters (where appropriate). In previous versions of PowerShell, ValidateSet made sure the user could enter only values listed in the validation set. In PowerShell 3.0, ISE now also uses the list to provide IntelliSense.

Here is a sample:

function Select-Color

  "You chose $Color"

Once you run this code and then in the ISE, enter this, you'll see the new argument completion in action:

Select-Color -Color <-ISE opens IntelliSense menu with color values

Twitter This Tip! ReTweet this Tip!