Skip to content

Where-Object formatting bug #2051

Closed
Closed
@jakauppila

Description

@jakauppila

System Details

System Details Output

### VSCode version: 1.35.1 c7d83e57cd18f18026a8162d042843bda1bcf21f x64

### VSCode extensions:
ms-vscode.powershell-preview@2019.5.0

### PSES version: 2.0.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.16299.1146
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.1146
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing a problem with auto-formatting when utilizing Where-Object with the following:

function Verb-Noun {
  Begin {
  }
  Process {
    foreach ($foo in $bar) {
      if ($something) {
        $somethingElse = ($something | Where-Object { $_ -eq $null })
    }
  }
  $variable = $null
}
End {
}
}

Expected Behaviour

function Verb-Noun {
  Begin {
  }
  Process {
    foreach ($foo in $bar) {
      if ($something) {
        $somethingElse = ($something | Where-Object { $_ -eq $null } )
      }
    }
    $variable = $null
  }
  End {
  }
}

Actual Behaviour

function Verb-Noun {
  Begin {
  }
  Process {
    foreach ($foo in $bar) {
      if ($something) {
        $somethingElse = ($something | Where-Object { $_ -eq $null })
    }
  }
  $variable = $null
}
End {
}
}

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