Skip to content

Code Formatting: Whitespace Before Open Brace #1531

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
dsolodow opened this issue Jun 16, 2020 · 4 comments
Closed

Code Formatting: Whitespace Before Open Brace #1531

dsolodow opened this issue Jun 16, 2020 · 4 comments

Comments

@dsolodow
Copy link

Issue Description

I am experiencing a problem with... "Code Formatting: Whitespace Before Open Brace" is creating a space between a parenthesis and the open brace.

Attached Logs

Follow the instructions in the README about
capturing and sending logs.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.19041
VSCode 1.46.0
PowerShell Extension Version 2020.6.0

PowerShell Information

Name Value
PSVersion 5.1.19041.1
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.19041.1
BuildVersion 10.0.19041.1
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
azure-account ms-vscode 0.8.11
bracket-pair-colorizer-2 CoenraadS 0.1.4
code-settings-sync Shan 3.4.3
code-spell-checker streetsidesoftware 1.9.0
gistfs vsls-contrib 0.1.1
github-markdown-preview bierner 0.0.2
gitlens eamodio 10.2.2
markdown-all-in-one yzhang 3.0.0
markdown-checkbox bierner 0.1.3
markdown-emoji bierner 0.0.9
markdown-preview-github-styles bierner 0.1.6
mssql ms-mssql 1.9.0
powershell ms-vscode 2020.6.0
project-manager alefragnani 11.0.1
rainbow-csv mechatroner 1.7.0
remote-containers ms-vscode-remote 0.122.1
remote-ssh ms-vscode-remote 0.51.0
remote-wsl ms-vscode-remote 0.44.3
vscode-docker ms-azuretools 1.3.0
vscode-markdownlint DavidAnson 0.36.0
vscode-yaml redhat 0.8.0
@SydneyhSmith SydneyhSmith transferred this issue from PowerShell/vscode-powershell Jun 16, 2020
@ghost ghost added the Needs: Triage 🔍 label Jun 16, 2020
@bergmeister
Copy link
Collaborator

@dsolodow Can you provide more details please?

Given the following snippet

if($foo){
    'hello'
}

The powershell.codeFormatting.whitespaceBeforeOpenBrace setting would make it insert a space before the open brace if the setting is set to true

if($foo) {
    'hello'
}

The powershell.codeFormatting.whitespaceBeforeOpenParen setting would make it insert a space before the open parenthesis if the setting is set to true

if ($foo){
    'hello'
}

If that is not the case for you please state that or your specific problem and the settings you use.

@dsolodow
Copy link
Author

Sure!

    [ValidateScript({Test-Path -Path $PSItem})]

If powershell.codeFormatting.whitespaceBeforeOpenBrace is true, it shows as:

    [ValidateScript( {Test-Path -Path $PSItem})]

I probably should have phrased my report better; it does as the setting name suggests insert whitespace before the open brace. However, the info with the setting says "Adds a space between a keyword and its associated scriptblock expression" and a parentheses isn't a keyword.

So perhaps this is better described as a mismatch between the behavior indicated by the setting description and the actual behavior.

@bergmeister
Copy link
Collaborator

Duplicate of #1468

@bergmeister bergmeister marked this as a duplicate of #1468 Jun 17, 2020
@ghost
Copy link

ghost commented Jun 18, 2020

This issue has been marked as duplicate and has not had any activity for 1 day. It will be closed for housekeeping purposes.

@ghost ghost closed this as completed Jun 18, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants