From fa0302f156870785f9cd0edebe529c18a24f8807 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Tue, 16 Apr 2024 13:40:13 -0400 Subject: [PATCH] terraform: Don't cache user-installed `terraform-ls` (#10641) This PR updates the Terraform extension to not cache the binary when it is using the one on the $PATH. Release Notes: - N/A --- extensions/terraform/src/terraform.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/extensions/terraform/src/terraform.rs b/extensions/terraform/src/terraform.rs index 8dfabce23e..e090395720 100644 --- a/extensions/terraform/src/terraform.rs +++ b/extensions/terraform/src/terraform.rs @@ -12,17 +12,16 @@ impl TerraformExtension { language_server_id: &LanguageServerId, worktree: &zed::Worktree, ) -> Result { + if let Some(path) = worktree.which("terraform-ls") { + return Ok(path); + } + if let Some(path) = &self.cached_binary_path { if fs::metadata(path).map_or(false, |stat| stat.is_file()) { return Ok(path.clone()); } } - if let Some(path) = worktree.which("terraform-ls") { - self.cached_binary_path = Some(path.clone()); - return Ok(path); - } - zed::set_language_server_installation_status( &language_server_id, &zed::LanguageServerInstallationStatus::CheckingForUpdate,