Format Script Hashtables many spaces

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
CermakPOI
Posts: 41
Last visit: Wed Jan 31, 2024 2:57 am

Format Script Hashtables many spaces

Post by CermakPOI »

Product: PowerShell Studio 2022 (64 Bit)
Build: v5.8.207
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.18363.0

PowerShell version(s): 5.1

*** Please add details and screenshots as needed below. ***

This issue is existing for a very long time, and now i need to report this.

The Format Script function adds as much spaces before the = when the next ?? line is long.

I try to show you. To replay this, you may need to play around a bit, delte some of the extra spaces...

1: My normal code as i would write it, but please be aware of the 30 spaces insetres before the = sign.

Code: Select all

$paramInvokeRestMethod += @{
	Uri																																								     = "$($CSDConnection.BaseURI)/tokenauth/api/$($Path)"
}
$headers.Add("Authorization", "Bearer $([Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR(($SecureToken))))")
2: When i add some dommy command "invalid" here, the formatting worls as expected.

Code: Select all

		
$paramInvokeRestMethod += @{
	Uri = "$($CSDConnection.BaseURI)/tokenauth/api/$($Path)"
}
invalid
$headers.Add("Authorization", "Bearer $([Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR(($SecureToken))))")
This happens also for Multi-Line Hashtable defintions. Sometiomes it's so bad, that the text is far away that i wonder why i did not put anything there where the = should be.
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 11:13 am
Answers: 39
Been upvoted: 30 times

Re: Format Script Hashtables many spaces

Post by brittneyr »

Thank you for reporting. I've been able to reproduce this issue and have filed a report with the development team.
Brittney
SAPIEN Technologies, Inc.
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 11:13 am
Answers: 39
Been upvoted: 30 times

Re: Format Script Hashtables many spaces

Post by brittneyr »

Please try build 5.8.209 and let me know if there is still a problem.
Brittney
SAPIEN Technologies, Inc.
This topic is 1 year and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.