Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(format/html): make element children break if attributes break #5027

Merged
merged 3 commits into from
Feb 7, 2025

Conversation

dyc3
Copy link
Contributor

@dyc3 dyc3 commented Feb 3, 2025

Summary

closes #5026

Test Plan

Added a snapshot test, and none of the other tests are affected.

@github-actions github-actions bot added A-Formatter Area: formatter L-HTML Language: HTML labels Feb 3, 2025
Comment on lines 135 to 144
[
// If the attribute group breaks, prettier always breaks the children as well.
&if_group_breaks(&expanded_children).with_group_id(Some(attr_group_id)),
// Otherwise, we can do whatever fits best for the children.
&if_group_fits_on_line(&best_fitting![
format_args![flat_children],
format_args![expanded_children]
])
.with_group_id(Some(attr_group_id))
]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to figure out why this sometimes doesn't emit content. The ordering of these lines also appears to change the outcome.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed a somewhat hacky workaround for this bug in 6e4b40e.

Copy link

codspeed-hq bot commented Feb 3, 2025

CodSpeed Performance Report

Merging #5027 will not alter performance

Comparing html-attr-makes-children-break (bfc1d92) with next (141f858)

Summary

✅ 94 untouched benchmarks

@dyc3 dyc3 force-pushed the html-attr-makes-children-break branch from 1c79995 to a90247b Compare February 6, 2025 15:05
@dyc3 dyc3 marked this pull request as ready for review February 7, 2025 14:42
@dyc3 dyc3 requested review from a team February 7, 2025 14:43
@dyc3 dyc3 merged commit 2696970 into next Feb 7, 2025
13 checks passed
@dyc3 dyc3 deleted the html-attr-makes-children-break branch February 7, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Formatter Area: formatter L-HTML Language: HTML
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants