Skip to content

Apply AlignAssignmentStatement overhaul from PR #2132#2166

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-build-error
Closed

Apply AlignAssignmentStatement overhaul from PR #2132#2166
Copilot wants to merge 3 commits intomainfrom
copilot/fix-build-error

Conversation

Copy link
Contributor

Copilot AI commented Mar 17, 2026

Ports the AlignAssignmentStatement rule rewrite from PR #2132 to fix several correctness and performance issues in hashtable alignment, and adds enum member value alignment.

Rule fixes

  • Expression keys with =: e.g. ($Key = 5) = "Value" previously caused Start position cannot be before End position — the rule was finding the wrong = token
  • Inline comments erased: Key <#comment#> = "Value" had the comment stripped during auto-correction
  • Quadratic perf: Per-KVP linear token scan made large files (~1000 hashtables × 100 KVP) take 457s → now ~2s via a single pre-pass token index

New features

  • Enum member value alignment (CheckEnums, IncludeValuelessEnumMembers, AlignEnumMemberWithInterveningComment)
  • AlignHashtableKvpWithInterveningComment setting to opt into aligning KVPs with intervening comments
  • Partial alignment: invalid/multi-line KVPs are now skipped individually rather than bailing on the entire hashtable

Breaking change

All new settings default to $true. Previously CheckHashtable defaulted to $false, so the rule was effectively a no-op by default; enabling it now does something meaningful.

Also fixed

Minor typos in comments and docs (trviallytrivially, it'sits, Enum'sEnums).

Copilot AI and others added 3 commits March 17, 2026 23:07
Co-authored-by: andyleejordan <2226434+andyleejordan@users.noreply.github.com>
Co-authored-by: andyleejordan <2226434+andyleejordan@users.noreply.github.com>
@andyleejordan
Copy link
Member

Copilot bad.

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.

2 participants