Can you (finally) fix the formatting issues?

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 3 years and 3 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
Jehoschua
Posts: 64
Last visit: Fri Mar 01, 2024 3:24 am

Can you (finally) fix the formatting issues?

Post by Jehoschua »

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


Good evening

Unfortunately, Sapien PowerShell Studio has some annoying formatting issues.

Example #1: Please allow us to Select Upper Camel Case by default
This is an annoying fun: The code generator creates this code:

Code: Select all

foreach ($Item in $Collection) {
  …	
}
But if one press Enter behind the '{', then we get the more readable 'Upper Camel Case':

Code: Select all

ForEach ($Item in $Collection) {
  …	
}
» It would be great if we could get the 'Upper Camel Case' by default, as other IDE supports, too.
This would help so that we don't deface the code of other developers when we work together.

Example #2: If above 'Else' is a comment, then please correctly indent the 'Else' keyword:

Code: Select all

If ($true) {
	# Do we have a?
	If ($obj -eq 'a') {
		# Code
	}
	# Do we have b?
ElseIf ($obj -eq 'b') {
		# Code
	}
}


Example #3: Very bad code formatting for Param():
Sapien wastes many lines if the Param() lines are formatted. We prefer this - it's perfectly readable and we usually get the overview of all parameters without scrolling:

Code: Select all

[CmdletBinding()]
Param (
	[Parameter(Position = 0, Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
	[String]$GroupName,
	# Comment 1
	[Switch]$Recursive = $true,
	# Comment 2
	[Switch]$SkipDisabledUsers
)
If Sapien formats this code, then we don't get a useful result:

Code: Select all

[CmdletBinding()]
Param (
	[Parameter(Position = 0, Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
	[String]$GroupName,
	
	# Comment 1

	
	[Switch]$Recursive = $true,
	
	# Comment 2

	
	[Switch]$SkipDisabledUsers
)
Sapien has those issues for a long time.
If you're not able to fix it:
Would it possibly be possible to integrate an external code formatting tool?
I don't know if there is a useful tool.

Thanks a lot, kind regards,
Thomas
User avatar
brittneyr
Site Admin
Posts: 1669
Last visit: Fri Apr 12, 2024 2:35 pm
Answers: 39
Been upvoted: 31 times

Re: Can you (finally) fix the formatting issues?

Post by brittneyr »

We appreciate your feedback and will look into these issues. When I have more information, I'll post here.
Brittney
SAPIEN Technologies, Inc.
User avatar
brittneyr
Site Admin
Posts: 1669
Last visit: Fri Apr 12, 2024 2:35 pm
Answers: 39
Been upvoted: 31 times

Re: Can you (finally) fix the formatting issues?

Post by brittneyr »

We have updated our formatter to not add a new line after comments in param blocks. This will be released following the next service build release.

As for the other format issue with Upper Camel case, I have no updates.
Brittney
SAPIEN Technologies, Inc.
This topic is 3 years and 3 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.