Use the project env when running LSPs (#20641)
This change ensures we always run LSPs with the project environment (in addition to any overrides they provide). This helps ensure the environment is set correctly on remotes where we don't load the login shell environment and assign it to the current process. Also fixed the go language to use the project env to find the go command. Release Notes: - Improved environment variable handling for SSH remotes
This commit is contained in:
parent
56c93be4de
commit
7f52071513
2 changed files with 6 additions and 13 deletions
|
@ -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"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue