Skip to content

Trying to rename "use alias" in VSCode messes up with files from other crates #5198

Open
@ararunaufc

Description

@ararunaufc

Hello. I'm not sure what is the "official" name of the renaming imports construct in Rust, so I'm referring to it as "use alias" both in the title and in the body of this issue. Fell free to fix this and delete this part, please.

What is wrong?

When trying to rename the "alias" part of the "use alias" using the Rename Symbol functionality from VSCode (F2), the original name is the one that gets replaced. Moreover, it seems that the change is applied to every source file that uses the previous original name as a mod name in every crate we depend on.

What should happen instead?

I expected that only the new name and its corresponding usages in the current file be changed.

MWE

main.rs

use std::io as foo;

fn main() {
    let _ = foo::empty();
    println!("Hello, world!");
}

Cargo.toml

Just the most basic

Steps taken

  1. click on the foo "alias"
  2. use the "Rename Symbol" utility (F2)
  3. enter the value "bar"
  4. bug!
    4.1. A lot of files get opened by VSCode, none of them from our crate
    4.2 All of the opened files have changes relating to the renaming we tried to do

System info

  • Using VSCode 1.46.1
    • rust-analyser 0.2.224 extension
  • Using rustc 1.44.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-idegeneral IDE featuresC-bugCategory: bugE-unknownIt's unclear if the issue is E-hard or E-easy without digging inS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions