Skip to content

Formatting issue with New-Object and Trim Whitespace for Props #1540

Closed
@jkewley

Description

@jkewley

Copied over from the VS Code repo

System Details

### VSCode version: 1.47.0 d5e9aa0227e057a60c82568bf31c04730dc15dcd x64

### VSCode extensions:
[email protected]
[email protected]
[email protected]      
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected] 
[email protected]    
[email protected]      
[email protected]
[email protected] 
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]


### PSES version: 2.2.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      7.0.2
PSEdition                      Core
GitCommitId                    7.0.2
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue Description

PowerShell setting Code Formatting : Whitespace Between Parameters has a bug when formatting
New-Object PSObject -Property code.

Given:

$whoisthis = New-Object PSObject -Property @{
Somebody = "once told me"
That     = "the world is gonna roll me"
}

reformatting without the setting checked gives us

$whoisthis = New-Object PSObject -Property @{
    Somebody = "once told me"
    That     = "the world is gonna roll me"
}

with the option checked we get

$whoisthis = New-Object PSObject -Property @{
    Somebody "once told me"
    That = "the world is gonna roll me"
}

which is illegal (equals sign is gone after 'Somebody')

Expected Behaviour

I would expect this:

$whoisthis = New-Object PSObject -Property @{
    Somebody = "once told me"
    That = "the world is gonna roll me"
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions