Skip to content

Commit a341836

Browse files
author
James Brundage
committed
Join-PipeScript: Fixing .Substring errors (#116)
1 parent 6d550d5 commit a341836

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Join-PipeScript.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ function Join-PipeScript
120120
if ($BlockType -contains 'param') {
121121
foreach ($combined in $AllScriptBlocks.Ast.ParamBlock) {
122122
if (-not $combined.Parent.Extent) { continue }
123-
$combined.Parent.Extent.ToString().Substring(0, $combined.Extent.StartOffset)
123+
$offsetDifference = $combined.Extent.StartOffset - $combined.Parent.Extent.StartOffset
124+
$combined.Parent.Extent.ToString().Substring(0, $offsetDifference) -replace '^[\r\n]+\{'
124125
}
125126
}
126127
# Start the param block

0 commit comments

Comments
 (0)