Skip to content

Preserve relative indentation in comment runs - #2236

Merged
Christoph Bergmeister (bergmeister) merged 2 commits into
copilot/fix-psuseconsistentindentation-issuefrom
copilot/fix-code-based-on-review-comment
Oct 26, 2026
Merged

Christoph Bergmeister (bergmeister) merged 2 commits into
copilot/fix-psuseconsistentindentation-issuefrom
copilot/fix-code-based-on-review-comment

Conversation

Copilot AI commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Comment runs lost relative indentation when correction clipped each comment line independently. Apply a shared shift constrained by the run’s least-indented line.

  • Behavior: Preserve indentation offsets across the full run, including when its first comment is not the least-indented.
  • Regression coverage: Add space- and tab-indented cases, such as:
        # inner
    # outer

Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code for review comment in pull request Preserve relative indentation in comment runs 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.

🟢 Approval recommended

The localized change addresses the indentation loss with regression coverage for both indentation styles and no unresolved findings.

No open issues 🎉

What changed in this PR

This PR updates the indentation rule to preserve relative spacing within contiguous comment runs, even when the first comment is not the least-indented.

Changes:

  • Calculate comment offsets from the least-indented line in the full run.
  • Add regression cases for space and tab indentation.
File Description
Tests/​Rules/​UseConsistentIndentation.tests.ps1 Adds space- and tab-indented regression cases with a more-indented first comment.
Rules/​UseConsistentIndentation.cs Uses the run’s minimum starting column as the shared indentation baseline.

Review effort: Balanced

@bergmeister
Christoph Bergmeister (bergmeister) marked this pull request as ready for review October 26, 2026 11:18
@bergmeister
Christoph Bergmeister (bergmeister) merged commit 0c2d630 into copilot/fix-psuseconsistentindentation-issue Oct 26, 2026
8 checks passed
@bergmeister
Christoph Bergmeister (bergmeister) deleted the copilot/fix-code-based-on-review-comment branch October 26, 2026 11:18
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