Skip to content

Instantly share code, notes, and snippets.

@ninmonkey
Last active July 1, 2023 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninmonkey/292f1f391f00815f32e0cf716b11ccc5 to your computer and use it in GitHub Desktop.
Save ninmonkey/292f1f391f00815f32e0cf716b11ccc5 to your computer and use it in GitHub Desktop.
format-predent-test.md

using crazy padding as example input

Samples

Case1: Output

$x =
Get-ChildItem ~ -Depth 1 | Group-Object Extension |
    | Format-Table

$query
| Sort-Object key
| Format-Table -GroupBy 'Name'

if ($true) {
    $query
    | Sort-Object key
    | Format-Table -GroupBy 'Name'
}


$query | Sort-Object function
| Format-Table -GroupBy 'Name'

Case1: Raw Input

# using crazy padding as example input
$x =
            gci ~ -depth 1 | Group Extension |
| ft

$query
    | Sort-Object key
        | Format-Table -GroupBy 'Name'

if($true) {
    $query
                 | Sort-Object key
            | Format-Table -GroupBy 'Name'
}


    $query| Sort-Object function
    | Format-Table -GroupBy 'Name'

user config settings.json

{
    "powershell.codeFormatting.newLineAfterCloseBrace": true,
    "powershell.codeFormatting.newLineAfterOpenBrace": true,
    "powershell.codeFormatting.openBraceOnSameLine": true,
    "powershell.codeFormatting.autoCorrectAliases": false,
    "powershell.codeFormatting.pipelineIndentationStyle": "None",
    "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline",
    "powershell.codeFormatting.whitespaceAfterSeparator": true,
    "powershell.codeFormatting.whitespaceAroundOperator": true,
    "powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
    "powershell.codeFormatting.whitespaceBeforeOpenParen": true,
    "powershell.codeFormatting.whitespaceBetweenParameters": true,
    "powershell.codeFormatting.whitespaceInsideBrace": true,
    "powershell.codeFormatting.avoidSemicolonsAsLineTerminators": true,
    "powershell.codeFormatting.useCorrectCasing": true,
    "powershell.codeFormatting.addWhitespaceAroundPipe": true,
    "powershell.codeFormatting.ignoreOneLineBlock": true,
    "powershell.codeFormatting.preset": "Stroustrup"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment