Formatter: Wrap attributes based on maxLineLength only#1834
Open
andy-rootly wants to merge 4 commits into
Open
Formatter: Wrap attributes based on maxLineLength only#1834andy-rootly wants to merge 4 commits into
andy-rootly wants to merge 4 commits into
Conversation
Previously, the formatter wrapped tags one-attribute-per-line under two conditions: when the opening tag would exceed `maxLineLength`, OR when the tag had more than 3 attributes. The count rule was surprising in practice — `<div a="1" b="2" c="3" d="4">` wrapped at 36 chars, well under the 80-char default. This removes the count rule. Wrapping is now driven purely by `maxLineLength`, which matches user expectation and the docs. Refs marcoroth#928, marcoroth#1823 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Five tests in CI still expected one-per-line wrapping based on the old count heuristic. Under the new length-only behavior these inputs fit within the 80-char default and stay inline; one test's input was widened to genuinely exceed maxLineLength so it still demonstrates wrap behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The 71-char opening tag fits within maxLineLength so it stays inline, but the whole `<div>...</div>Content` line is 85 chars, so the formatter still moves the content onto separate lines. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
attribute-renderer.ts:91. Wrapping is now driven purely bymaxLineLength.maxLineLengthdoc note added in Docs: Note multi-attribute wrap behavior onmaxLineLength#1823.Follow-up to #1823 / #928. The count heuristic was surprising —
<div a="1" b="2" c="3" d="4">wrapped at 36 chars under the 80-char default, with no way for the user to opt out. After this PR, the same tag stays inline; long tags still wrap.Test plan