Repository navigation
Handle multiple comments per line in indentation runs - #2249
Merged
Christoph Bergmeister (bergmeister) merged 3 commits intoOct 27, 2026
Conversation
Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix code based on review comment
Handle multiple comments per line in indentation runs
Oct 27, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Continuation indentation remains incorrect for following arguments, and the backward scan adds avoidable quadratic work.
2 open issues
What changed in this PR
This PR updates the indentation formatter to preserve relative comment indentation when a comment-only line contains multiple adjacent block comments.
Changes:
- Scan adjacent comment tokens in both directions when identifying comment runs.
- Add a regression test for adjacent block comments followed by a more-indented comment.
| File | Description |
|---|---|
| Tests/Rules/UseConsistentIndentation.tests.ps1 | Adds coverage for preserving indentation after adjacent block comments. |
| Rules/UseConsistentIndentation.cs | Expands comment-run scanning to handle multiple comments per line. |
Review effort: Balanced
Co-authored-by: bergmeister <9250262+bergmeister@users.noreply.github.com>
Christoph Bergmeister (bergmeister)
marked this pull request as ready for review
October 27, 2026 11:30
Christoph Bergmeister (bergmeister)
requested a review
from a team
as a code owner
October 27, 2026 11:30
Christoph Bergmeister (bergmeister)
removed this pull request from stack #2250
October 27, 2026 11:30
Christoph Bergmeister (bergmeister)
merged commit Oct 27, 2026
0e5eb9f
into
copilot/fix-psuseconsistentindentation-issue
8 checks passed
Christoph Bergmeister (bergmeister)
deleted the
copilot/fix-code-review-comment
branch
October 27, 2026 11:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Comment-run scanning assumed one comment token per line, so adjacent block comments could split a run and flatten the indentation of a following comment.