vscode-rust
vscode-rust copied to clipboard
Renaming items also renames the crate keyword
Steps to reproduce:
- Create a new library crate, in
lib.rscopy-paste the following code.
enum EnumTest {}
mod test {
use crate::EnumTest;
}
- Using rename symbol feature, rename the
EnumTestin first line to anything else. It would result to the following code.
enum AnythingElse {}
mod test {
use AnythingElse::AnythingElse;
}
As you can see, it also renames the crate keyword, which is unexpected.
Interestingly, using glob-like brace syntax on use declaration, i.e. use crate::{EnumTest, anything_else_here}, will cause renaming to fail. Another interesting note is that when I tried this with struct, it fails to rename. So I tested it with other kinds of items: struct, enum, type alias, union, trait, function, const, and static; it appears almost all kinds of items that I tested have the same behavior when renaming with exception to struct. I used the following code for completeness.
struct StructTest;
enum EnumTest {}
type TypeTest = StructTest;
union UnionTest {
test: i32,
}
trait TraitTest {}
fn function_test() {}
const CONST_TEST: i32 = 10;
static STATIC_TEST: i32 = 10;
mod test {
use crate::function_test;
use crate::EnumTest;
use crate::StructTest;
use crate::TraitTest;
use crate::TypeTest;
use crate::UnionTest;
use crate::CONST_TEST;
use crate::STATIC_TEST;
}
VSCode version: 1.50.1 (user setup) OS: Windows_NT x64 10.0.18363 Rust extension version: v0.7.8