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

Formatting with --stdin and --rustfmt adds additional empty lines #92

Closed
koopa1338 opened this issue Oct 28, 2023 · 0 comments · Fixed by #95
Closed

Formatting with --stdin and --rustfmt adds additional empty lines #92

koopa1338 opened this issue Oct 28, 2023 · 0 comments · Fixed by #95
Labels
bug Something isn't working

Comments

@koopa1338
Copy link
Contributor

koopa1338 commented Oct 28, 2023

I did set up my rust-analyzer as described in the readme and formatting works, however when formatting that way it adds 2 newlines at the end of each file.

A quick test shows that formatting with stdin flag outputs new lines at the end. I guess that formatting the output of the leptosfmt and piping that to rustfmt has a bug, keeping a newline. Here is a diff of the following commands:

cat src/main.rs | leptosfmt --stdin | rustfmt
cat src/main.rs | leptosfmt --stdin -r

diff:

mod app;

use app::*;
use leptos::*;

pub fn main() {
    _ = console_log::init_with_level(log::Level::Debug);
    console_error_panic_hook::set_once();

    mount_to_body(|| {
        view! { <App/> }
    });
}
+

Edit: It seems like multiple formats on the same file will add more empty lines

@bram209 bram209 added the bug Something isn't working label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants