diff --git a/crates/languages/src/go.rs b/crates/languages/src/go.rs index 8713495b31..669f6918a9 100644 --- a/crates/languages/src/go.rs +++ b/crates/languages/src/go.rs @@ -89,8 +89,7 @@ impl super::LspAdapter for GoLspAdapter { let delegate = delegate.clone(); Some(cx.spawn(|cx| async move { - let install_output = process::Command::new("go").args(["version"]).output().await; - if install_output.is_err() { + if delegate.which("go".as_ref()).await.is_none() { if DID_SHOW_NOTIFICATION .compare_exchange(false, true, SeqCst, SeqCst) .is_ok() @@ -139,7 +138,8 @@ impl super::LspAdapter for GoLspAdapter { let gobin_dir = container_dir.join("gobin"); fs::create_dir_all(&gobin_dir).await?; - let install_output = process::Command::new("go") + let go = delegate.which("go".as_ref()).await.unwrap_or("go".into()); + let install_output = process::Command::new(go) .env("GO111MODULE", "on") .env("GOBIN", &gobin_dir) .args(["install", "golang.org/x/tools/gopls@latest"]) diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index 5f1f6a88ad..0723ba689b 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -5540,16 +5540,9 @@ impl LspStore { binary.arguments = arguments.into_iter().map(Into::into).collect(); } - // If we do have a project environment (either by spawning a shell in in the project directory - // or by getting it from the CLI) and the language server command itself - // doesn't have an environment, then we use the project environment. - if binary.env.is_none() { - log::info!( - "using project environment for language server {:?}", - adapter.name() - ); - binary.env = Some(delegate.shell_env().await); - } + let mut shell_env = delegate.shell_env().await; + shell_env.extend(binary.env.unwrap_or_default()); + binary.env = Some(shell_env); Ok(binary) }) }