Skip to content

PipelineIndentationStyle: Incorrect formatting when using None #1496

Closed
@bergmeister

Description

@bergmeister

This can be repro-ed when setting the vs code setting powershell.codeFormatting.pipelineIndentationStyle to its new default None (default in PSSA is still NoIndentation)

Steps to reproduce

Invoke-Formatter -Settings @{ IncludeRules = @('PSUseConsistentIndentation'); Rules = @{ PSUseConsistentIndentation = @{ Enable = $true; PipelineIndentation = 'None' } }  } -ScriptDefinition @'         
@{
      foo      = "dfsf"
    bar = "dddff"
}

    foreach ($Test in $Test1) {
    foreach ($Test2 in $TEst3) {

    }
    }
'@

Expected behavior

@{
    foo = "dfsf"
    bar = "dddff"
}

foreach ($Test in $Test1) {
    foreach ($Test2 in $TEst3) {

    }
}

Actual behavior

@{
      foo      = "dfsf"
    bar = "dddff"
}

    foreach ($Test in $Test1) {
    foreach ($Test2 in $TEst3) {

    }

If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *

Environment data

PSSA 1.19.0

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