FormatPowershellCode icon indicating copy to clipboard operation
FormatPowershellCode copied to clipboard

Infinite new lines

Open rangedsp opened this issue 9 years ago • 2 comments

Heya, I've written a script that looks at a directory and runs the formatter every second on all .ps1 files.

When it came to this code,

Write-Host($subs | Format-Table -Property @{name="Option";expression={$global:indexSub;$global:indexSub+=1}}, SubscriptionId, SubscriptionName | Out-String)

The formatter adds a newline to the front of Out-String, eventually it becomes:

Write-Host($subs |
    Format-Table -Property @{name="Option";expression={$global:indexSub;$global:indexSub+=1}}, SubscriptionId, SubscriptionName |



    Out-String)

And that blank space increases ad infinitum.

rangedsp avatar May 04 '16 23:05 rangedsp

What is the exact formatting code you are using so I can replicate this issue?

zloeber avatar May 05 '16 02:05 zloeber

I'm doing this:

Get-Content $scriptName -raw  |
            Format-ScriptReplaceHereStrings |
            Format-ScriptReduceLineLength |
            Format-ScriptFormatCodeIndentation 

Thanks :)

rangedsp avatar May 05 '16 05:05 rangedsp