Page 1 of 1

Formatting of code within parenthesis not correctly indented

Posted: Thu Apr 14, 2016 12:19 pm
by jasnic02
Product, version and build: PowerShell Studio 2016 build 5.2.118
32 or 64 bit version of product: 64 bit
Operating system: Windows 8.1
32 or 64 bit OS: 64
PowerShell Version: 5.0

When PSStudio formats the code, the code within the parenthesis are not indented properly. Unless I'm missing an option somewhere? If not, is this something that could be corrected in the formatting rules?

Code: Select all

#For example:
$test = $(
    if ($true) {
        'this is true'
    }
    else {
        'this is not true'
    }
)

#becomes:
$test = $(
if ($true) {
    'this is true'
}
else {
    'this is not true'
}
)

#and this:
$arr = @(
    'one',
    'two',
    'three'
)

#becomes:
$arr = @(
'one',
'two',
'three'
)

#As expected, this indents properly:
$test = $(if ($true) {
    'this is true'
}
else {
    'this is not true'
})

#However, this does not:
$arr = @('one',
'two',
'three'
)

Re: Formatting of code within parenthesis not correctly indented

Posted: Thu Apr 14, 2016 3:38 pm
by davidc
Indentation is only calculated by curly brackets and doesn't not include parenthesis. However I will add in a feature request and pass it along to the team.

David