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

📎 HTML: Implement "Attribute Position" option #4828

Open
Tracked by #4726
dyc3 opened this issue Jan 3, 2025 · 8 comments · May be fixed by #4972
Open
Tracked by #4726

📎 HTML: Implement "Attribute Position" option #4828

dyc3 opened this issue Jan 3, 2025 · 8 comments · May be fixed by #4972
Assignees
Labels
A-Formatter Area: formatter good first issue Good for newcomers L-HTML Language: HTML

Comments

@dyc3
Copy link
Contributor

dyc3 commented Jan 3, 2025

Description

The attribute position option has 2 values: auto and multiline. auto is the current behavior, and the default behavior. This task is to implement the multiline side of this option.

Want to contribute? Lets you know you are interested! We will assign you to the issue to prevent several people to work on the same issue. Don't worry, we can unassign you later if you are no longer interested in the issue! Read our contributing guide.

@dyc3 dyc3 added good first issue Good for newcomers A-Formatter Area: formatter L-HTML Language: HTML labels Jan 3, 2025
@Geun-Oh
Copy link

Geun-Oh commented Jan 5, 2025

@dyc3 May I take this issue?

@ematipico
Copy link
Member

@dyc3 should we implement this against the next or main branch?

@dyc3
Copy link
Contributor Author

dyc3 commented Jan 5, 2025

This should be applied to next

@dyc3
Copy link
Contributor Author

dyc3 commented Jan 23, 2025

Hey @Geun-Oh, any updates?

@Geun-Oh
Copy link

Geun-Oh commented Jan 23, 2025

@dyc3 Hello, I'm sorry about the late notice.

Since I'm not good at rust that much than i thought (even though i selected a good-first-issue,,) and I'm also struggling hard on my job these days, it takes long time that i thought.

So, you can unassign me if you wanna assign other person.
Or I'll do my best.

Thanks for waiting.

@dyc3
Copy link
Contributor Author

dyc3 commented Jan 23, 2025

No worries! I'll unassign you for now.

@ematipico
Copy link
Member

For whoever wants to contribute, the implementation of this option isn't complicated, because we already have this logic in the JSX formatting.

Here's how it works in the JSX formatter

fn fmt(&self, node: &JsxAttributeList, f: &mut JsFormatter) -> FormatResult<()> {
let line_break = if f.options().attribute_position() == AttributePosition::Multiline {
hard_line_break()
} else {
soft_line_break_or_space()
};
f.join_with(&line_break)
.entries(node.iter().formatted())
.finish()
}

@Geun-Oh
Copy link

Geun-Oh commented Jan 26, 2025

@dyc3 Can I take this again? I think I can do this during holiday week.
And thanks to @ematipico :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Formatter Area: formatter good first issue Good for newcomers L-HTML Language: HTML
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants