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

Allow parentheses for short expressions #7

Closed
aDogCalledSpot opened this issue Jan 12, 2024 · 1 comment
Closed

Allow parentheses for short expressions #7

aDogCalledSpot opened this issue Jan 12, 2024 · 1 comment

Comments

@aDogCalledSpot
Copy link

aDogCalledSpot commented Jan 12, 2024

The braces look good if there's a lot of content but personally I like using the round parentheses if there isn't a lot of content.

e.g.

match State {
    State::Loading => html!(<Spinner />),
    State::Ready(props) => html!(<MyComponent ..props />),
}

compared to

match State {
    State::Loading => html! { <Spinner /> },
    State::Ready(props) => html! { <MyComponent ..props /> },
}

The question is what constitutes a "short" expression. I would suggest either fits in one line or is a self-closing tag. I prefer the previous to allow something like html!(<p>Hello World</p>).

@aDogCalledSpot aDogCalledSpot changed the title Allow parantheses for short expressions Allow parentheses for short expressions Jan 14, 2024
its-the-shrimp added a commit that referenced this issue Jan 25, 2024
@its-the-shrimp
Copy link
Owner

Thank you for reporting this, in v0.3.0 yew-fmt doesn't coerce parentheses into curly brackets

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