rust-lang/rust-analyzer

Refactor Preview window shows every time when `discoverConfig` is in use

Opened this issue · 4 comments

Description: We recently enabled discoverConfig in the Fuchsia tree with a custom script to accelerate symbol indexing. However, whenever I pass in that setting to rust-analyzer and I attempt to run a rename action from VSCode, it opens up the preview pane (regardless of my VSCode settings for it) with no lines selected.

This sounds somewhat related to #17422, I suspect that because of the partial workspace load we can't be sure we shouldn't be refactoring symbols outside of the loaded graph. But this makes it a rather poor experience (especially if the symbol I'm trying to rename is pub(crate) or lower -- meaning we should have full view and allow a refactor.

rust-analyzer version:

rust-analyzer --version
rust-analyzer true (fca718c0f2 2025-11-01)

editor or extension: VSCode
relevant settings: rust-analyzer.workspace.discoverConfig

Does your config include "is_workspace_member": true for every workspace member?

No it doesn't, is that what's causing the problem?
How is "is_workspace_member": true related to this issue? I'm trying to see if there's a simply workaround we can apply on our side.
Is it bad if I mark vendored third-party crates with "is_workspace_member": true as well?

I tried something on the fuchsia side that does seem to fix things. I did a primitive check for the vendored crates based on their path in the tree.

But in summary yes, setting is_workspace_member: true does seem to fix that behavior. Does this mean the auto-detection is doing something wrong or is this working as expected? if the latter we can probably close the bug.

I appreciate the help.

The preview window is shown whenever a library source code will be changed. The auto-detection is based on the path opened in the editor, and I don't know why it fails - only you can tell.