Skip to content

Formatter: Preserve author-expanded multi-line ERB tags - #2059

Merged
marcoroth merged 3 commits into
marcoroth:mainfrom
G-Rath:formatting
Aug 7, 2026
Merged

Formatter: Preserve author-expanded multi-line ERB tags#2059
marcoroth merged 3 commits into
marcoroth:mainfrom
G-Rath:formatting

Conversation

@G-Rath

@G-Rath G-Rath commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Resolves #1835

@github-actions github-actions Bot added formatter @herb-tools/formatter for HTML+ERB templates typescript TypeScript source across the javascript/ packages labels Aug 7, 2026
@G-Rath

G-Rath commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@marcoroth let me know what you think of this! I have done this with some help from AI, and ended up having to use an EC2 instance to sort all the dependencies for building, but I'm really happy with how small a patch this ended up requiring.

I've run it over a few of our codebases internally and it's working a treat: adding a newline before the tag in e.g. <%= link_to( has the formatter mirror that on the closing side, and vice versa if you remove the newline.

Comment thread javascript/packages/formatter/test/erb/multiline.test.ts

@marcoroth marcoroth left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks @G-Rath! 馃檶馃徏

This indeed looks reasonable, thank you!

I only got this one comment about the squashing in the attribute value case, but otherwise I think this looks good.

@marcoroth marcoroth left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you @G-Rath! 馃檹馃徏

@marcoroth
marcoroth merged commit cd0a2eb into marcoroth:main Aug 7, 2026
14 checks passed
@G-Rath
G-Rath deleted the formatting branch August 7, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

formatter @herb-tools/formatter for HTML+ERB templates typescript TypeScript source across the javascript/ packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Formatter: Formatting of multi-line methods calls

2 participants