From 53105ddd166a0d2ee5e02ab51c9ac906bc0ec9c5 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Tue, 16 Apr 2024 13:11:58 -0400 Subject: [PATCH] gleam: Don't cache user-installed `gleam` (#10635) This PR updates the Gleam extension to not cache the binary when it is using the one on the $PATH. Release Notes: - N/A --- extensions/gleam/src/gleam.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/extensions/gleam/src/gleam.rs b/extensions/gleam/src/gleam.rs index b754d705c9f5db78f3ce4e4cb69377da1104a410..8deef729d4e00b9580a30b1dc7c2067942ec8b8a 100644 --- a/extensions/gleam/src/gleam.rs +++ b/extensions/gleam/src/gleam.rs @@ -13,17 +13,16 @@ impl GleamExtension { language_server_id: &LanguageServerId, worktree: &zed::Worktree, ) -> Result { + if let Some(path) = worktree.which("gleam") { + 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("gleam") { - self.cached_binary_path = Some(path.clone()); - return Ok(path); - } - zed::set_language_server_installation_status( &language_server_id, &zed::LanguageServerInstallationStatus::CheckingForUpdate,