Skip to content

CodeFormatting alignPropertyValuePairs breaks with property name containing a period #1337

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
X-Guardian opened this issue May 29, 2018 · 2 comments

Comments

@X-Guardian
Copy link

  • Operating system name and version: Windows Server 2012 R2
  • VS Code version: 1.23.1
  • PowerShell extension version: 1.7.0
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.0.10586.117
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.117
CLRVersion                     4.0.30319.36440
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing the following problem with the powershell.codeFormatting.alignPropertyValuePairs setting.

With this set to true, the following sample code will have the property value pairs correctly aligned when the document is formatted:

$Hashtable1 = @{
    FirstEntry         = 'first'
    SecondEntry        = 'second'
    ThirdEntry         = 'third'
    LastExtraLongEntry = 'last'
}

If a new hashtable is added anywhere in the code that has a property name that contains a period, then the formatting breaks and undoes the PropertyValuePair alignment for the whole document:

$Hashtable1 = @{
   FirstEntry = 'first'
   SecondEntry = 'second'
   ThirdEntry = 'third'
   LastExtraLongEntry = 'last'
}

$Hashtable2 = @{
   $Tag.key = 'test'
}
@rkeithhill
Copy link
Contributor

rkeithhill commented May 29, 2018

Can you file this issue on the PSScriptAnalyzer project? The extension uses PSSA for code analysis and code formatting.

@X-Guardian
Copy link
Author

Issue raised in the PSScriptAnalyzer project, reference #1003. Should be fixed in PSScriptAnalyzer v1.17

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

No branches or pull requests

2 participants