Skip to content

Fmt removes newlines on top scopes #3007

@fabiodcorreia

Description

@fabiodcorreia

Problem

Running dx fmt --all-code the new lines that separate the top level blocks get deleted. It's not a critical issue but can be annoying.

use dioxus_logger::tracing;
fn main() {
    dioxus_logger::init(tracing::Level::INFO).expect("failed to init logger");
    tracing::info!("starting app");
    launch(App);
}
fn App() -> Element {
    //...
}
#[server(PostServerData)]
async fn post_server_data(data: String) -> Result<String, ServerFnError> {
    //...
}

Steps To Reproduce

Steps to reproduce the behavior:

  • Generate a new fullstack app
  • Insure between the main, App and post_server_data functions and the last use there is a new line
  • Run dx fmt --all-code

Expected behavior

The new line should stay between the functions like this

use dioxus_logger::tracing;

fn main() {
    dioxus_logger::init(tracing::Level::INFO).expect("failed to init logger");
    tracing::info!("starting app");
    launch(App);
}

fn App() -> Element {
    //...
}

#[server(PostServerData)]
async fn post_server_data(data: String) -> Result<String, ServerFnError> {
    //...
}

Environment:

  • Dioxus version: 0.5.7
  • Rust version: 1.81
  • OS info: MacOS Intel
  • App platform: Fullstack

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later

Metadata

Metadata

Assignees

No one assigned

    Labels

    autoformattingRelated to the autofmt cratebugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions