Skip to content

Setting 'newLineAfterCloseBrace' not recognizing instances where a newline should not be added. #559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jasnic02 opened this issue Mar 16, 2017 · 0 comments · Fixed by PowerShell/PSScriptAnalyzer#741
Labels
Milestone

Comments

@jasnic02
Copy link

System Details

  • Operating system name and version: Windows 10 Pro
  • VS Code version: 1.10.2
  • PowerShell extension version: 0.10
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.1.14393.953
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.953
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

With the setting "powershell.codeFormatting.newLineAfterCloseBrace" set to true, the formatter changes this:

$obj = $data | Select-Object -Property @{
    Name       = 'PropertyName1'
    Expression = { $_.ThePropertyName1 }
}, @{
    Name       = 'PropertyName2'
    Expression = { $_.ThePropertyName2 }
}

to this:

$obj = $data | Select-Object -Property @{
    Name       = 'PropertyName1'
    Expression = { $_.ThePropertyName1 }
}
, @{
    Name       = 'PropertyName2'
    Expression = { $_.ThePropertyName2 }
}

and this:

$obj = $data | Select-Object -Property @{
    Name       = 'PropertyName1'
    Expression = { $_.ThePropertyName1 }
} -Unique

to this:

$obj = $data | Select-Object -Property @{
    Name       = 'PropertyName1'
    Expression = { $_.ThePropertyName1 }
}
-Unique

Is there a way to ignore the closing braces that have valid code behind it on the same line (in these cases a comma or a dash, but I expect there are other scenarios)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants