Skip to content

Conversation

@Wilfred
Copy link
Contributor

@Wilfred Wilfred commented Nov 28, 2025

Previously, rust-analyzer would drop discover requests that arrived before we'd finished processing the previous request.

This is particularly noticeable when starting VS Code with multiple Rust files which require separate configuration discovery, as only the first file gets IDE features.

Fix this by allowing multiple discover requests to be active. Keep track of the number of discover operations for the quiescence check, and keep the process handles until they terminate.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 28, 2025
pub(crate) discover_handles: Vec<discover::DiscoverHandle>,
pub(crate) discover_sender: Sender<discover::DiscoverProjectMessage>,
pub(crate) discover_receiver: Receiver<discover::DiscoverProjectMessage>,
pub(crate) discover_jobs_active: AtomicU32,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could actually be a plain u32. I saw the mutexes elsewhere in this struct but I'm not accessing this value from other threads.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be a u32, we only write to it in &mut self paths, so there is no point in using an atomic here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

@Wilfred Wilfred force-pushed the multiple_discover_requests branch from 1cf1798 to 3d78edb Compare December 1, 2025 10:58
@Veykril
Copy link
Member

Veykril commented Dec 1, 2025

has been a while since that test flaked

@Wilfred
Copy link
Contributor Author

Wilfred commented Dec 1, 2025

Huh, it's syntax_highlighting::tests::syntax_highlighting_not_quadratic failing and only on macOS. I'm pretty confident that isn't affected by these changes?

Previously, rust-analyzer would drop discover requests that arrived
before we'd finished processing the previous request.

Fix this by allowing multiple discover requests to be active. Keep
track of the number of discover operations for the quiescence check,
and keep the process handles until they terminate.
@Wilfred Wilfred force-pushed the multiple_discover_requests branch from 3d78edb to d2505d9 Compare December 1, 2025 13:17
@Wilfred
Copy link
Contributor Author

Wilfred commented Dec 1, 2025

Rebased to trigger another CI run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants