Skip to content

Preserve comment indentation after pipelines with PipelineIndentation=None - #2241

Merged
Christoph Bergmeister (bergmeister) merged 3 commits into
copilot/fix-psuseconsistentindentation-issuefrom
copilot/fix-review-comment-2231
Oct 26, 2026
Merged

Christoph Bergmeister (bergmeister) merged 3 commits into
copilot/fix-psuseconsistentindentation-issuefrom
copilot/fix-review-comment-2231

Conversation

Copilot AI commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

With PipelineIndentation=None, only the first standalone comment after a pipe was skipped; later comments in the same run could be flattened, losing their relative indentation.

  • Change: Detect when a comment run starts after a pipe and skip indentation corrections for the full run.
  • Regression example:
    foo |
        # first comment
            # second comment

Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code issue raised in review comment Preserve comment indentation after pipelines with PipelineIndentation=None Oct 26, 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.

🟡 Changes recommended

The regression fixture contains an unfinished pipeline, producing a parse-error diagnostic that fails its empty-diagnostics assertion.

1 open issue
What changed in this PR

This PR updates the indentation rule to preserve an entire comment run after a pipe when PipelineIndentation=None, keeping relative comment indentation intact.

Changes:

  • Detect whether a comment run starts after a pipe and skip indentation corrections for the full run.
  • Add analyzer and formatter regression assertions for differently indented comments.
File Description
Tests/​Rules/​UseConsistentIndentation.tests.ps1 Adds regression coverage for preserving comment-run indentation.
Rules/​UseConsistentIndentation.cs Detects pipeline-prefixed comment runs and preserves their indentation with None.

Review effort: Balanced

Comment thread Tests/Rules/UseConsistentIndentation.tests.ps1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

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

The localized fix matches the reported defect, includes targeted regression coverage, and has no unresolved findings.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@bergmeister
Christoph Bergmeister (bergmeister) marked this pull request as ready for review October 26, 2026 21:44
@bergmeister
Christoph Bergmeister (bergmeister) merged commit b028aaf into copilot/fix-psuseconsistentindentation-issue Oct 26, 2026
8 checks passed
@bergmeister
Christoph Bergmeister (bergmeister) deleted the copilot/fix-review-comment-2231 branch October 26, 2026 21:44
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