From 8eebb3561f7efaa8a8436b61bc8d883d978c5cb8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 27 Oct 2026 05:17:23 +0000 Subject: [PATCH 1/2] Initial plan From bf24b466d3e3e2becb6baae146e3000f8e7ba407 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 27 Oct 2026 05:21:15 +0000 Subject: [PATCH 2/2] Fix continued comment argument indentation Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com> --- Rules/UseConsistentIndentation.cs | 3 ++- Tests/Rules/UseConsistentIndentation.tests.ps1 | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Rules/UseConsistentIndentation.cs b/Rules/UseConsistentIndentation.cs index 2dedf530a..4dc2ed6ca 100644 --- a/Rules/UseConsistentIndentation.cs +++ b/Rules/UseConsistentIndentation.cs @@ -376,8 +376,9 @@ private static int GetCommentRunIndentationOffset( GetCommentRunIndentationOffset( tokens, tokenIndex - 2, - out _, + out bool precedingCommentRunStartsAfterLineContinuation, out commentRunStartsAfterPipeline); + commentRunStartsAfterLineContinuation |= precedingCommentRunStartsAfterLineContinuation; } return 0; diff --git a/Tests/Rules/UseConsistentIndentation.tests.ps1 b/Tests/Rules/UseConsistentIndentation.tests.ps1 index a48cf33c5..cd295dca8 100644 --- a/Tests/Rules/UseConsistentIndentation.tests.ps1 +++ b/Tests/Rules/UseConsistentIndentation.tests.ps1 @@ -268,6 +268,18 @@ Write-Output ` Should -Be $scriptDefinition } + It 'Should preserve continuation indentation before a block-comment-prefixed argument' { + $scriptDefinition = @' +Write-Output ` + # comment + <# note #> -InputObject 'value' +'@ + $settings.Rules.PSUseConsistentIndentation.PipelineIndentation = 'NoIndentation' + + Invoke-Formatter -ScriptDefinition $scriptDefinition -Settings $settings | + Should -Be $scriptDefinition + } + It 'Should preserve indentation when the first comment is not the least-indented with indentation' -TestCases @( @{ Kind = 'space'; Indentation = ' ' } @{ Kind = 'tab'; Indentation = "`t" }