Description
System Details
System Details Output
### VSCode version: 1.32.3 a3db5be9b5c6ba46bb7555ec5d60178ecc2eaae4 x64
### VSCode extensions:
[email protected]
### PSES version: 1.12.0.0
### PowerShell version:
Name Value
---- -----
PSVersion 5.1.14409.1018
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1018
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Description
Setting powershell.codeFormatting.pipelineIndentationStyle to "IncreaseIndentationForFirstPipeline" or "IncreaseIndentationAfterEveryPipeline" causes every line after a single-line pipeline to be un-indented by an extra level. Setting the value to the default "NoIndentation" value, pipelines are ignored and indentation behaviour returns to that which was provided in the previous release of vscode-PowerShell.
Use this code for example:
function Test-Function ($FullPath) {
if ($FullPath) {
# These lines have pipelines split over two lines. They indent as expected.
$Path = $FullPath |
Split-Path -Parent
$FileName = $FullPath |
Split-Path -Leaf
# These lines have full pipelines. Each removes an additional indentation.
$Path = $FullPath | Split-Path -Parent
$FileName = $FullPath | Split-Path -Leaf
$Path = $Path.Trim()
$FileName = $FileName.Trim()
return Join-Path $Path $FileName
}
}
Expected Behaviour
If a line contains a complete pipeline (i.e., one that does not continue on the following line), the following line should be at the same indentation level unless it closes a code or evaluation block as per normal indentation rules:
function Test-Function ($FullPath) {
if ($FullPath) {
# These lines have pipelines split over two lines. They indent as expected.
$Path = $FullPath |
Split-Path -Parent
$FileName = $FullPath |
Split-Path -Leaf
# These lines have full pipelines. Each removes an additional indentation.
$Path = $FullPath | Split-Path -Parent
$FileName = $FullPath | Split-Path -Leaf
$Path = $Path.Trim()
$FileName = $FileName.Trim()
return Join-Path $Path $FileName
}
}
Actual Behaviour
Each complete, single-line pipeline removes one indentation level for all lines following it, in addition to normal end-block un-indentation:
function Test-Function ($FullPath) {
if ($FullPath) {
# These lines have pipelines split over two lines. They indent as expected.
$Path = $FullPath |
Split-Path -Parent
$FileName = $FullPath |
Split-Path -Leaf
# These lines have full pipelines. Each removes an additional indentation.
$Path = $FullPath | Split-Path -Parent
$FileName = $FullPath | Split-Path -Leaf
$Path = $Path.Trim()
$FileName = $FileName.Trim()
return Join-Path $Path $FileName
}
}
Attached Logs
Logs will be send directly.