-1

You can define auto-completion results for parameter values in a variety of different ways such as using dynamic parameters, the CompletionResult class within a parameter's ArgumentCompleter attribute declaration, the ValidateSet attribute, etc.

If tab-completion results aren't declared, then PowerShell (by default) will return a contextual list of provider objects/items for parameter value auto-completion suggestions (whether "autocompleted" with Tab or CTRL+SPACE).


For example, pressing CTRL+SPACE after Test -ParamName shows a list of filesystem objects.

enter image description here



I know that CTRL+SPACE is PSReadLine's MenuComplete function at work, but even if PSReadLine is removed, the default behavior of returning contextual provider objects still persists when using Tab to autocomplete parameter values.

Is this default behavior/preference (of returning provider objects) exposed anywhere like an automatic variable, .NET class property/field, .ps1xml file, etc?

Paul π
  • 133
  • 11
  • 1
    this is the default behavior of `tabexpansion2`, more specifically `[System.Management.Automation.CommandCompletion]::CompleteInput` when there are no completion results it will default to the child items in the current location – Santiago Squarzon Aug 30 '23 at 21:53
  • 1
    Thank you Santiago! If you put this into an answer I'll mark it as such. Thanks again :) – Paul π Aug 30 '23 at 22:05
  • heh unfortunately the question is closed. i've voted to reopen it but there needs to be 3 votes for that to happen :) – Santiago Squarzon Aug 30 '23 at 22:08

0 Answers0