Skip to content

Update snippets to use either settings.json formatting rules or be updated to reflect what appear to be the community-agreed-upon formatting rules #2610

Open
@brianwest

Description

@brianwest

Snippet format update

As a PowerShell developer, I'd like to see the built-in snippets reflect what appear to be the community-agreed-upon formatting rules so that I, and I'm assuming others, don't have to reformat them.

If feasible, it might be best to have the snippets formatted based upon the rules specified in settings.json. Otherwise, and it may be even better solution, have the snippets follow what appear to be the community-agreed-upon formatting rules

My understanding is that the PowerShell community-agreed-upon formatting rules are as follows:

"powershell.codeFormatting.openBraceOnSameLine": false,
"powershell.codeFormatting.newLineAfterOpenBrace": false,
"powershell.codeFormatting.newLineAfterCloseBrace": true,
"powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
"powershell.codeFormatting.whitespaceBeforeOpenParen": true,
"powershell.codeFormatting.whitespaceAroundOperator": true,
"powershell.codeFormatting.whitespaceAfterSeparator": true,
"powershell.codeFormatting.ignoreOneLineBlock": false,
"powershell.codeFormatting.preset": "Custom",

However, the snippets don't follow these rules. The comment-based help snippet is the most troublesome. In addition to not following the formatting rules, the components show as:

<#
.SYNOPSIS
Short description
.DESCRIPTION
Long description
.EXAMPLE
PS C:>
Explanation of what the example does
.INPUTS
Inputs (if any)
.OUTPUTS
Output (if any)
.NOTES
General notes
#>

I propose it looks like:

<#
    .SYNOPSIS
        Short description

    .DESCRIPTION
        Long description

    .PARAMETER Parameter
        Description of parameter

    .EXAMPLE
        PS C:\> <example usage>
        Explanation of what the example does

    .NOTES
        General notes
#>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions