bram209 / leptosfmt

A formatter for the leptos view! macro
Apache License 2.0
272 stars 29 forks source link

Blank line added after some code blocks #125

Closed paul-hansen closed 4 months ago

paul-hansen commented 4 months ago

What happened

Using leptosfmt . to format code that has rust code in a {} block inside a view sometimes adds a blank line after the block. It seems to depend on the content of the code block, most commonly noticed in blocks that contain match or if statements.

Expected

No blank lines added after code blocks

Example

Before

                view! {
                    <h2>
                        {match error_code {
                            StatusCode::SERVICE_UNAVAILABLE => "custom error msg".to_string(),
                            error_code => error_code.to_string(),
                        }}
                    </h2>
                }

After leptosfmt .

                view! {
                    <h2>
                        {match error_code {
                            StatusCode::SERVICE_UNAVAILABLE => "custom error msg".to_string(),
                            error_code => error_code.to_string(),
                        }}

                    </h2>
                }

Notice the blank line after the double closing brackets.

Tested with 0.1.18 from crates.io and latest main.