Skip to content

RFC: Change Pipeline Indentation Style default from NoIndentation to IncreaseIndentationForFirstPipeline #4296

Open

Description

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.

Summary

I've discovered that our default value to configure PSScriptAnalyzer's PipelineIndentation setting is NoIndentation, which differs from PSSA's own default (and arguably more popular) of IncreaseIndentationForFirstPipeline. This was last updated in May 2020 via #2698 which alludes to a bug in PSSA that I hope is since fixed.

Christoph Bergmeister (@bergmeister) in particular, what do you think?

Proposed Design

Just update the default in package.json to IncreaseIndentationForFirstPipeline. While I think this is a very desirable behavior, it would come at the cost of user-facing change that would affect formatting of scripts. So the question is, have the vast majority of people already overridden it with IncreaseIndentationForFirstPipeline?

Further RFC: Should we do a just an overhaul of all our default code formatting settings to match PSSA's defaults?

Activity

  1. ghost added
    Needs: TriageMaintainer attention needed!
    on Dec 1, 2022
  2. JustinGrote commented on Dec 1, 2022

    @JustinGrote
    Collaborator

    The only issue I can think of is that people who have format-on-save set are gonna have a lot of suddenly large git commits and not understand why.

    I think all the defaults to match PSSA defaults should be done all at once as a single breaking change with a popup dialog at start letting people know it has changed and give them a button to go back, maybe have an overarching "classic" setting to allow people to bypass that, rather than onesy-twosy.

  3. bergmeister commented on Dec 2, 2022

    @bergmeister
    Contributor

    This needs historic background:
    When I first added this feature and setting, IncreaseIndentationForFirstPipeline was actually the default but it turned out that even after a couple iterations there were still some edge cases. Therefore I added this NoIndentation option later, which kind of acts like a feature flag to provide the behaviour it had before I added the feature to reduce the blast radius and give me more time to work on fixing edge cases.
    It's hard to say whether the feature is now good enough for everyone to be on by default but with the preview extension we could try temporarily? Would it help if I look up existing issues of this setting to help make a decision?

  4. seppo498573908457 commented on Jun 16, 2026

    @seppo498573908457

    Hi all. I found this ticket from a link in VSCode settings requesting for comments.

    My comment is that IncreaseIndentationForFirstPipeline is good for readability. And that we need the same setting for indentation for multiline statements that are written with a backtick ` at the end of the line. And you could extend this setting to cover cases where the pipe | is placed at the beginning of the next line rather than at the end of the preceding line, having backtick or not.

  5. steevcoco commented on Oct 18, 2026

    @steevcoco

    I'll add a comment in case it is useful in some way: it's simply that PowerShell "appends to the pipe as it goes" and having no indent indicates to me as difference between that language and C#; and also, a parenthised block becomes indented, which visually continues the same connection to the flow. (I.E: it's better to understand the actual Scopes; which didn't change between two pipeline outputs; making that indent less about the actual Scope than an arbitrary choice "as you type". It's too flowery.)

    If the default changes, I myself may change it back ...

    # Which function is guaranteed to pipeline 3 items?
    
    function Foo()
    {
        DoA
            DoB
            DoC
        if (x) {
            throw
        }
    }
    function Bar()
    {
        DoA
        DoB
        DoC
        if (x) {
            throw
        }
    }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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