From 96ff6d86a3666b4efcd5ae16b008e286405e9b98 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 9 Jul 2025 13:43:17 -0400 Subject: [PATCH] Fix autocomplete on settings.json after reload (#34142) Closes #31850 https://github.com/user-attachments/assets/6182ef64-3ce6-49ed-a91b-770c51cb6e94 Release Notes: - Fixed autocomplete on settings.json after restarting Zed --- crates/project/src/lsp_store.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index 8a14e02e0b40946ed8e81b72e6cea5eb2a6c56ef..3e8917d91b6f1d5c811495349a0a0734827aa084 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -10671,6 +10671,21 @@ impl LspStore { } // Tell the language server about every open buffer in the worktree that matches the language. + // Also check for buffers in worktrees that reused this server + let mut worktrees_using_server = vec![key.0]; + if let Some(local) = self.as_local() { + // Find all worktrees that have this server in their language server tree + for (worktree_id, servers) in &local.lsp_tree.read(cx).instances { + if *worktree_id != key.0 { + for (_, server_map) in &servers.roots { + if server_map.contains_key(&key.1) { + worktrees_using_server.push(*worktree_id); + } + } + } + } + } + let mut buffer_paths_registered = Vec::new(); self.buffer_store.clone().update(cx, |buffer_store, cx| { for buffer_handle in buffer_store.buffers() { @@ -10684,7 +10699,7 @@ impl LspStore { None => continue, }; - if file.worktree.read(cx).id() != key.0 + if !worktrees_using_server.contains(&file.worktree.read(cx).id()) || !self .languages .lsp_adapters(&language.name())