Skip to content

"editor.formatOnType": true (vscode) behaves weirdly with calls (and attributes on calls) #16848

@WaffleLapkin

Description

@WaffleLapkin

rust-analyzer version: 0.4.1881-standalone (14558af 2024-03-14)

relevant settings: "editor.formatOnType": true

code snippet to reproduce:

fn main() {
    f();

    #[allow(unreachable_code)]
    g();
}

If I type { before f(); nothing happens (well, except the { that was typed, obv). If I type { before g(); a matching } is added but not where I'd expect:

fn main() {
    {f();

    #[allow(unreachable_code)]
    {g}();
}

This is what I would expect to see instead:

fn main() {
    { f() };

    #[allow(unreachable_code)]
    { g() };
}

Metadata

Metadata

Assignees

Labels

C-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions