Vscode-powershell: Adding an exception to the 'newLineAfterCloseBrace' setting

Created on 17 Mar 2017  路  4Comments  路  Source: PowerShell/vscode-powershell

System Details

  • Operating system name and version: MacOS Sierra
  • VS Code version: 1.10.2
  • PowerShell extension version: 0.10.1
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      Core
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.15
CLRVersion
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I like the newLineAfterCloseBrace setting but I'd rather it not apply all the time. For example, in the scenario where I'm using a where or foreach method. https://www.screencast.com/t/KFWP9dDE66z0

This is how I'd like it to format:

@().foreach({

})

However, this is how it does:

@().foreach({

    })

You can see that a bracket ending with a new line isn't always involved with a control statement.

Area-Code Formatting Issue-Enhancement

Most helpful comment

@DarkLite1 I will take a look at this issue tonight (by looking at it I think it might already be fixed in the next upcoming version of PSSA). I think we can close this issue now that the issues has been moved to PSSA

All 4 comments

Same issue here and I was almost filing a new issue until GitHub suggested it existed already. Verry annoying formatting:

image

Still present in the latest insider:

Version: 1.33.0-insider (user setup)
Commit: 9b849d9de7168eb4f685823bf9b9e27a0a8dae74
Date: 2019-03-08T06:59:35.464Z
Electron: 3.1.3
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 6.2.9200

Any updates if a fix would be possible?

All of the formatting features are provided by the PSScriptAnalyzer. If this issue hasn't already been submitted to that project, please submit it there where the PSSA owners will see it. https://github.com/powershell/psscriptanalyzer

Thank you @rkeithhill , opened a new issue here as you suggested.

@DarkLite1 I will take a look at this issue tonight (by looking at it I think it might already be fixed in the next upcoming version of PSSA). I think we can close this issue now that the issues has been moved to PSSA

Was this page helpful?
0 / 5 - 0 ratings