Skip to content

Multiline formatting does not indent correctly #1290

Closed
@andrewducker

Description

@andrewducker

Issue Description

I am experiencing a problem with formatting of multiline commands. Particularly with comments in them. Given the following command, this is how Powershell formats it:

ls c:\ |
select -ExpandProperty name |
sort -Descending

If I put in backticks then the formatter notices:

ls c:\ | `
    select -ExpandProperty name | `
    sort -Descending `

which is what I would expect.
However, if I then put in comments I get:

ls c:\ | `
    #Then select the name
select -ExpandProperty name | `
    #Before sorting in descending order
sort -Descending `

Which doesn't look right to me.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 6.1.7601
VSCode 1.36.1
PowerShell Extension Version 2019.5.0

PowerShell Information

Name Value
PSVersion 5.1.14409.1018
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.14409.1018
BuildVersion 10.0.14409.1018
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
gitlens eamodio 9.8.5
json-tools eriklynd 1.0.2
powershell ms-vscode 2019.5.0
printcode nobuhito 3.0.0
qub-xml-vscode qub 1.2.8
XMLLanguageSupport IBM 0.0.1
zenburn ryanolsonx 1.0.1

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