GeezerVison is showing github.com — Preserve relative indentation in comment runs by Copilot · Pull Request #2236 · PowerShell/PSScriptAnalyzer
Conversation
Copilot
AI
commented
Oct 26, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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:
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Copilot
AI
changed the title
[WIP] Fix code for review comment in pull request
Preserve relative indentation in comment runs
Oct 26, 2026
There was a problem hiding this comment.
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
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.