Skip to content

fix(generator): "Align equal signs within groups" preference has no effect on keys after the first in each group - #53

Merged
unknowIfGuestInDream merged 1 commit into
masterfrom
copilot/fix-align-equal-signs
May 15, 2026
Merged

unknowIfGuestInDream merged 1 commit into
masterfrom
copilot/fix-align-equal-signs

Conversation

Copilot AI commented May 15, 2026 •

Copy link
Copy Markdown

When groupKeys is enabled, equalIndex was computed once per group (for the first key) and reused for all subsequent keys in that group. With alignment disabled (alignEqualSigns=false or groupAlignEqualSigns=false), getEqualIndex() returns key.length() — correct for the first key, but wrong for every other key in the group, which has a different length. Result: equal signs were misaligned regardless of the preference setting.

Change

Added an else if to the group-processing loop in PropertiesGenerator.generate() that updates equalIndex per-key whenever alignment is disabled:

if (newGroup == null || !newGroup.equals(group)) {
    group = newGroup;
    equalIndex = getEqualIndex(key, group, bundle);   // once per group (alignment case)
    ...
} else if (!RBEPreferences.getAlignEqualSigns()
        || !RBEPreferences.getGroupAlignEqualSigns()) {
    equalIndex = key.length();                        // per-key (no-alignment case)
}

The expensive getEqualIndex() loop (which scans all keys) is still only called once per group when alignment is actually on. The no-alignment path is now a cheap direct assignment of key.length(), consistent with what getEqualIndex() already returns for the first key in those cases.

Copilot AI linked an issue May 15, 2026 that may be closed by this pull request
@unknowIfGuestInDream
unknowIfGuestInDream marked this pull request as ready for review May 15, 2026 12:40
@unknowIfGuestInDream
unknowIfGuestInDream self-requested a review May 15, 2026 12:40
Copilot AI changed the title [WIP] Fix align equal signs within groups functionality fix(generator): "Align equal signs within groups" preference has no effect on keys after the first in each group May 15, 2026
…bled for grouped keys

Agent-Logs-Url: https://github.com/tlcsdm/eclipse-rbe/sessions/8455d053-a604-4851-9486-216a7a8ddc32

Co-authored-by: unknowIfGuestInDream <57802425+unknowIfGuestInDream@users.noreply.github.com>
@unknowIfGuestInDream
unknowIfGuestInDream force-pushed the copilot/fix-align-equal-signs branch from ea8d98f to 675a1da Compare May 15, 2026 12:47
@unknowIfGuestInDream
unknowIfGuestInDream merged commit 1be8c2e into master May 15, 2026
17 checks passed
@unknowIfGuestInDream
unknowIfGuestInDream deleted the copilot/fix-align-equal-signs branch May 15, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Align equal signs within groups does not work.

2 participants