Skip to content

generate_new loses indent #19784

Open
@A4-Tacks

Description

@A4-Tacks

rust-analyzer version: rust-analyzer 1.86.0 (05f9846 2025-03-31)

rustc version: rustc 1.86.0 (05f9846f8 2025-03-31)

code snippet to reproduce:

mod foo {
    struct $0Foo {}
}

->

mod foo {
    struct Foo {}

impl Foo {
    fn new() -> Self {
        Self {  }
    }
}
}

Expect:

mod foo {
    struct Foo {}

    impl Foo {
        fn new() -> Self {
            Self {  }
        }
    }
}

Similar to:

mod foo {
    struct $0Foo {}

    impl Foo {
        fn some() {}
    }
}

->

mod foo {
    struct Foo {}

    impl Foo {
        fn new() -> Self {
        Self {  }
    }

        fn some() {}
    }
}

Expect:

mod foo {
    struct Foo {}

    impl Foo {
        fn new() -> Self {
            Self {  }
        }

        fn some() {}
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions