Skip to content

Reference module with Functions-specific command declarations #577

@AnatoliB

Description

@AnatoliB

When authoring PowerShell functions, the Functions-specific commands (such as Push-OutputBinding, Invoke-ActivityFunction, etc.) are difficult to discover. The user must find the names and invocation syntax in the documentation and type them in correctly. These commands cannot be discovered interactively via the regular PowerShell means (Get-Help, Get-Command), and VSCode cannot help with autocomplete, IntelliSense, etc., which complicates functions authoring.

These commands are defined in an internal module that is automatically loaded by the worker during function execution. However, this module cannot be imported into a standalone PowerShell session because of the dependency on worker's internals.

What we can do is provide a special reference module containing all the commands with parameters and help text, with a "do-nothing" implementation. We will update this module on adding or changing commands, and we will distribute it together with the PowerShell worker (so it always stays in sync with the actual implementation).

Challenge: it would be great if we could make sure this module automatically loaded when Functions are authored in VSCode. At the same time, we don't want this module to be loaded into the sessions used for executing Functions code, so including this module into the global PSModulePath is probably not a good idea. In the worst case, we can document manual steps, and this will be an improvement comparing to the current situation, but can we find a better way?

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions