Skip to content

Regression in autoformatting of multiline pipes #2213

@chriskuech

Description

@chriskuech

Issue Description

I am experiencing a problem with... The formatter. I have NoIndentation set up in my "Pipeline Indentation Style" but it seems to have regressed and is no longer properly formatting my code. I have provided an error case below, but I have also observed issues with Pester test formatting with this pipe style.

Ultimately, we developed this pipe style (backticks and pipe on the same line) to circumvent either prior issues or limitations with the formatter. Now we have a large code base that is growing increasing formatting issues. I would like this resolved, but I am also in any mitigation that can automatically be applied (ie only reformatting without modifying content), so preserving backticks.

Expected formatting

class Image {
    [string]$Registry
    [string]$Repository
    [string]$Name
    [string]$VersionTag

    Image([string] $Tag) {
        $pattern = "(?<registry>)(:(?<port>))?/(:(?<versionTag>.+))"
        if (-not ($Tag -match $pattern)) {
            throw ""
        }

        "Registry", "Port", "Name", "VersionTag" `
        | ForEach-Object { $this.$_ = $Matches[$_] }
    }

    [string] ToString() {
        return ""
    }
}

Observed formatting

class Image {
    [string]$Registry
    [string]$Repository
    [string]$Name
    [string]$VersionTag

    Image([string] $Tag) {
        $pattern = "(?<registry>)(:(?<port>))?/(:(?<versionTag>.+))"
        if (-not ($Tag -match $pattern)) {
            throw ""
        }

        "Registry", "Port", "Name", "VersionTag" `
        | ForEach-Object { $this.$_ = $Matches[$_] }
}

[string] ToString() {
    return ""
}
}

Attached Logs

Follow the instructions in the README about
capturing and sending logs.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.18362
VSCode 1.38.1
PowerShell Extension Version 2019.9.0

PowerShell Information

Name Value
PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.10032.0 6.2.3
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
azure-account ms-vscode 0.8.4
azurecli ms-vscode 0.4.6
azurerm-vscode-tools msazurermtools 0.6.0
beautify HookyQR 1.5.0
csharp ms-vscode 1.21.3
debugger-for-chrome msjsdiag 4.12.0
hyper-term-theme hsnazar 0.3.0
kusto-syntax-highlighting josin 1.0.1
markdown-converter manuth 3.0.2
powershell ms-vscode 2019.9.0
remote-wsl ms-vscode-remote 0.39.5
team ms-vsts 1.149.2
vscode-apache mrmlnc 1.2.0
vscode-docker ms-azuretools 0.8.1
vscode-eslint dbaeumer 1.9.1
vscode-jest Orta 3.0.2
vscode-kubernetes-tools ms-kubernetes-tools 1.0.4
vscode-markdown-to-clipboard mlewand 0.0.2
vscode-pitch-black-theme viktorqvarfordt 1.2.3
vscode-typescript-tslint-plugin ms-vscode 1.2.2
vscode-yaml redhat 0.5.3
vscode-zipexplorer slevesque 0.3.1
xml DotJoshJohnson 2.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions