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

[Discussion] How many braced variables should be put on one line? #15

Open
aDogCalledSpot opened this issue Feb 12, 2024 · 2 comments
Open

Comments

@aDogCalledSpot
Copy link

It makes sense to say that

html! {
    <Component>{ foo }</Component>

is formatted correctly.

However something like

html! {
    <Component>
         { foo }
         { bar }
         { baz }
         { foobar }
   </Component>
}

should maybe be kept that way even though it could possibly be merged onto one line.

I think there might be semantic meaning to the variables that would make you prefer splitting the lines (e.g. components into new lines, strings onto same line).

Would always splitting lines at two variables make sense?

@its-the-shrimp
Copy link
Owner

My idea with leaving multiple blocks on 1 line was that this way the blocks will look like string interpolation

html! {
    <h1>{ "Hello, " }{ user }</h1>
}

But I agree there might be cases where that's not desired, maybe there should be a formatting option for that

@aDogCalledSpot
Copy link
Author

Yes, that's what I was thinking of too. I think there is semantic meaning that decides how a user would want to format this which is problematic for a formatter 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants