Skip to content

Fill match arms fill at the wrong place on vscode #15310

Closed
@FirelightFlagboy

Description

@FirelightFlagboy

Version

rust-analyzer version: rust-analyzer version: 0.3.1591-standalone

rustc version: rustc 1.70.0 (90c541806 2023-05-31)

relevant settings: Not special settings or configuration.

Description

I'm writing rust in vscode and when I have a match that I want RA to fill, RA put the code at the wrong place.

I've the following sample code:

#[wasm_bindgen]
pub fn hello_world() {
    let value: Result<bool, ()> = Ok(true);

    match value {}
}

When I place my cursor on value on the line match value ... and execute the quick action Fill match arms it result in the following code:

{
    Ok(_) => todo!(),
    Err(_) => todo!(),
}
pub fn hello_world() {
    let value: Result<bool, ()> = Ok(true);

    match value {}
}

What I see:

  1. The match value arms aren't filled.
  2. The #[wasm_bindgen] was replaced by the completion of RA for the match arms.

That behavior doesn't exist if I remove #[wasm_bindgen] or replace it with #[test].

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions