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

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

Closed
FirelightFlagboy opened this issue Jul 19, 2023 · 0 comments · Fixed by #15345
Closed

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

FirelightFlagboy opened this issue Jul 19, 2023 · 0 comments · Fixed by #15345
Labels
A-assists A-macro macro expansion C-bug Category: bug

Comments

@FirelightFlagboy
Copy link

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].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-assists A-macro macro expansion C-bug Category: bug
Projects
None yet
2 participants