Skip to content

Automatically split | characters to a new line #1345

@thomasrea0113

Description

@thomasrea0113

Summary of the new feature/enhancement

I should state that I am using VS Code. I was told that for this feature to be possible in VS Code, it has to first be implemented here. The setting I mention down below is a VS Code Powershell setting.

I'd like to the ability to take the following line:

$Ports | ForEach-Object -Process { NETSTAT.EXE -ano | findstr.exe :8080 | ForEach-Object -Process { ($_ -split '\s+')[-1] } | Sort-Object | Get-Unique | ForEach-Object -Process { taskkill.exe /F /PID $_ } }

and convert it to:

$Ports |
    ForEach-Object -Process {
        NETSTAT.EXE -ano |
            findstr.exe :8080 |
            ForEach-Object -Process {
                ($_ -split '\s+')[-1]
            } | Sort-Object |
            Get-Unique |
            ForEach-Object -Process {
                taskkill.exe /F /PID $_
            }
    }

I think this would go a long way in approving readability. At the very least, with the

"powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline"

setting enabled, when I manually add the new line after each |, { , and }, it will format the indentation correctly which is nice.

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