intellij-powershell
intellij-powershell copied to clipboard
Inline parameter comments are outdented by formatter with no way to configure alternative
Desired behavior
Comments for parameters are aligned with the parameters and/or an option is provided in the format settings to allow such customization. When commented in this way, they will be used in PowerShell's Get-Help cmdlet for the function defined.
It's frustrating that there's actually no current way to prevent this formatting that I have found.
For example (using a function from the PSGallery) :
function New-OSDPartitionWindows {
[CmdletBinding()]
param (
#Fixed Disk Number
#For multiple Fixed Disks, use the SelectDisk parameter
#Default = 0
#Alias = Disk, Number
[Alias('Disk','Number')]
[int]$DiskNumber = 0,
#Drive Label of the Windows Partition
#Default = OS
#Alias = LW, LabelW
[Alias('LW','LabelW')]
[string]$LabelWindows = 'OS',
#Drive Label of the Recovery Partition
#Default = Recovery
#Alias = LR, LabelR
[Alias('LR','LabelR')]
[string]$LabelRecovery = 'Recovery',
#Skips the creation of the Recovery Partition
[switch]$SkipRecoveryPartition,
#Size of the Recovery Partition
#Default = 990MB
#Range = 350MB - 80000MB (80GB)
#Alias = SR, Recovery
[Alias('SR','Recovery')]
[ValidateRange(350MB,80000MB)]
[uint64]$SizeRecovery = 990MB
)
Current behavior
Comments are outdented like the below:
function New-OSDPartitionWindows {
[CmdletBinding()]
param (
#Fixed Disk Number
#For multiple Fixed Disks, use the SelectDisk parameter
#Default = 0
#Alias = Disk, Number
[Alias('Disk','Number')]
[int]$DiskNumber = 0,
#Drive Label of the Windows Partition
#Default = OS
#Alias = LW, LabelW
[Alias('LW','LabelW')]
[string]$LabelWindows = 'OS',
#Drive Label of the Recovery Partition
#Default = Recovery
#Alias = LR, LabelR
[Alias('LR','LabelR')]
[string]$LabelRecovery = 'Recovery',
#Skips the creation of the Recovery Partition
[switch]$SkipRecoveryPartition,
#Size of the Recovery Partition
#Default = 990MB
#Range = 350MB - 80000MB (80GB)
#Alias = SR, Recovery
[Alias('SR','Recovery')]
[ValidateRange(350MB,80000MB)]
[uint64]$SizeRecovery = 990MB
)
Just to note, block comments are also outdented the same way, albeit only the line with the initial <#. This makes sense, except for still not being able to tell the first line to not be outdented.