Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/proc-macro-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pub struct ProcMacroClient {
/// That means that concurrent salsa requests may block each other when expanding proc macros,
/// which is unfortunate, but simple and good enough for the time being.
pool: Arc<ProcMacroServerPool>,
/// The path to the proc-macro server binary.
path: AbsPathBuf,
}

Expand Down
7 changes: 6 additions & 1 deletion crates/rust-analyzer/src/global_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,13 @@ pub(crate) struct GlobalState {
pub(crate) shutdown_requested: bool,
pub(crate) last_reported_status: lsp_ext::ServerStatusParams,

// proc macros
/// Clients of the proc-macro server.
///
/// One client per workspace, in the same order as `self.workspaces`. We don't store
/// the client in `self.workspaces` so that we can reload workspaces without
/// restarting the proc-macro server.
pub(crate) proc_macro_clients: Arc<[Option<anyhow::Result<ProcMacroClient>>]>,

pub(crate) build_deps_changed: bool,

// Flycheck
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-analyzer/src/reload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ impl GlobalState {
Config::user_config_dir_path().as_deref(),
);

if (self.proc_macro_clients.is_empty() || !same_workspaces)
if (self.proc_macro_clients.len() < self.workspaces.len() || !same_workspaces)
&& self.config.expand_proc_macros()
{
info!("Spawning proc-macro servers");
Expand Down