Open bjorn3 opened 2 months ago
Does this always happen or only when renaming certain usages? r-a forces the preview when you are trying to edit a file that is a library https://github.com/veykril/rust-analyzer/blob/fa486e694e1fe7774f20350bb15ff933f670dc3c/crates/rust-analyzer/src/lsp/to_proto.rs#L1114-L1118
Though we haven't changed anything in this regard recently as far as I am aware
I'm working on a binary. Also turns out it happens with any refactor now, not just renames. Even a quick fix like "Fill struct fields".
I just tried reloading vscode, and now it doesn't show refactor previews anymore. Weird.
Hmm ye other refactors would do the same. That sounds like something confuse r-a quite a bit there 😕
@VladimirMakaev reported seeing this issue to me today in a closed-source linting CLI and I was able to consistently reproduce it. I think I've figured out the issue: it's the presence of of integration tests/snapshot tests that depend on the main Rust binary. They, for whatever reason, make rust-analyzer show the refactor preview for any chance because considers the binary a library.
Unless bjorn3 is using buck2—and I don't believe they are—I think the cause of this issue is some recent VFS/rust-analyzer.toml
-related changes that saw land recently.
the vfs/toml stuff didn't touch the CrateOrigin
's which is the only thing that affects this. VSCode will force a preview only for edits that change crates of type CrateOrigin::Library
aka crates that do not belong to your workspace.
rust-analyzer version: rust-analyzer version: 0.4.1997-standalone [/home/bjorn/.var/app/com.visualstudio.code/data/vscode/extensions/rust-lang.rust-analyzer-0.4.1997-linux-x64/server/rust-analyzer]
editor or extension: VSCode
This started happening just today. It is really annoying having to click on the checkbox for each file affected by the rename and then having to click accept. Previously F2, enter new name and enter was enough to apply a rename. I already tried
"editor.rename.enablePreview": false
, but that doesn't have any effect.