Home > OS >  AutoDocString for Powershell functions
AutoDocString for Powershell functions

Time:06-17

Do we have any VScode extension similar to https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring or any other way for providing auto doc string for PowerShell functions? Currently I've to add the doc string manually like this :

    <#
    .SYNOPSIS
        A brief description of the function or script.

    .DESCRIPTION
        A longer description.

    .PARAMETER FirstParameter
        Description of each of the parameters.
        Note:
        To make it easier to keep the comments synchronized with changes to the parameters,
        the preferred location for parameter documentation comments is not here,
        but within the param block, directly above each parameter.

    .PARAMETER SecondParameter
        Description of each of the parameters.

    .INPUTS
        Description of objects that can be piped to the script.

    .OUTPUTS
        Description of objects that are output by the script.

    .EXAMPLE
        Example of how to run the script.

    .LINK
        Links to further documentation.

    .NOTES
        Detail on what the script does, if this is needed.

    #>

CodePudding user response:

It is built-in with the PowerShell extension!

You can simply type ## the line above a function. It will auto-expand into a comment-based help block which does account for the current defined parameters.

  • Related