Page 1 of 1

Can you (finally) fix the formatting issues?

Posted: Tue Mar 17, 2020 4:59 pm
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

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

Posted: Wed Mar 18, 2020 2:35 pm
by brittneyr
We appreciate your feedback and will look into these issues. When I have more information, I'll post here.

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

Posted: Wed Jan 13, 2021 11:56 am
by brittneyr
A new format setting has been added to address adding new lines 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.