Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix rust-analyzer startup issue in single-file worktrees (#39441)
Tim Vermeulenf3abd1dab551
diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rsindex c91547c2304..998deb197fa 100644--- a/crates/project/src/lsp_store.rs+++ b/crates/project/src/lsp_store.rs@@ -12757,7 +12757,10 @@ impl LspAdapterDelegate for LocalLspAdapterDelegate {#[cfg(not(target_os = "windows"))]async fn which(&self, command: &OsStr) -> Option<PathBuf> {- let worktree_abs_path = self.worktree.abs_path();+ let mut worktree_abs_path = self.worktree_root_path().to_path_buf();+ if self.fs.is_file(&worktree_abs_path).await {+ worktree_abs_path.pop();+ }let shell_path = self.shell_env().await.get("PATH").cloned();which::which_in(command, shell_path.as_ref(), worktree_abs_path).ok()}@@ -12771,7 +12774,10 @@ impl LspAdapterDelegate for LocalLspAdapterDelegate {}async fn try_exec(&self, command: LanguageServerBinary) -> Result<()> {- let working_dir = self.worktree_root_path();+ let mut working_dir = self.worktree_root_path().to_path_buf();+ if self.fs.is_file(&working_dir).await {+ working_dir.pop();+ }let output = util::command::new_smol_command(&command.path).args(command.arguments).envs(command.env.clone().unwrap_or_default())