Skip to content

Preserve continuation indentation before block-comment-prefixed arguments - #2247

Merged
Christoph Bergmeister (bergmeister) merged 2 commits into
copilot/fix-psuseconsistentindentation-issuefrom
copilot/fix-code-for-review-comments
Oct 27, 2026
Merged

Christoph Bergmeister (bergmeister) merged 2 commits into
copilot/fix-psuseconsistentindentation-issuefrom
copilot/fix-code-for-review-comments

Conversation

Copilot AI commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

A block comment followed by executable code could lose the line-continuation state of the preceding comment run, causing the formatter to remove the argument’s continuation indentation.

  • Change: Propagate the preceding run’s continuation flag while preserving any direct continuation.
  • Regression: Cover a backtick-continued command with a standalone comment before a block-comment-prefixed argument.
Write-Output `
    # comment
    <# note #> -InputObject 'value'

Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code based on review comments Preserve continuation indentation before block-comment-prefixed arguments Oct 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the continuation-indentation change.

No open issues 🎉

What changed in this PR

This PR fixes continuation-indentation handling in the PowerShell formatter when an argument follows a block comment and a preceding standalone comment run.

Changes:

  • Propagate the preceding comment run’s continuation flag while preserving any direct continuation.
  • Add a regression test for a backtick-continued command with a block-comment-prefixed argument.
File Description
Tests/​Rules/​UseConsistentIndentation.tests.ps1 Adds regression coverage for preserving the argument’s continuation indentation.
Rules/​UseConsistentIndentation.cs Combines preceding and direct continuation flags when inspecting comment runs.

Review effort: Balanced

@bergmeister
Christoph Bergmeister (bergmeister) marked this pull request as ready for review October 27, 2026 09:23
@bergmeister
Christoph Bergmeister (bergmeister) merged commit be6251d into copilot/fix-psuseconsistentindentation-issue Oct 27, 2026
9 of 20 checks passed
@bergmeister
Christoph Bergmeister (bergmeister) deleted the copilot/fix-code-for-review-comments branch October 27, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants