Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gleam: Check for `gleam` on the PATH before installing the latest version (#9882)
Marshall Bowers95699a07f4c7
diff --git a/extensions/gleam/src/gleam.rs b/extensions/gleam/src/gleam.rsindex 4503e5d1d32..a5b594759d2 100644--- a/extensions/gleam/src/gleam.rs+++ b/extensions/gleam/src/gleam.rs@@ -6,13 +6,22 @@ struct GleamExtension {}impl GleamExtension {- fn language_server_binary_path(&mut self, config: zed::LanguageServerConfig) -> Result<String> {+ fn language_server_binary_path(+ &mut self,+ config: zed::LanguageServerConfig,+ worktree: &zed::Worktree,+ ) -> Result<String> {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(&config.name,&zed::LanguageServerInstallationStatus::CheckingForUpdate,@@ -88,10 +97,10 @@ impl zed::Extension for GleamExtension {fn language_server_command(&mut self,config: zed::LanguageServerConfig,- _worktree: &zed::Worktree,+ worktree: &zed::Worktree,) -> Result<zed::Command> {Ok(zed::Command {- command: self.language_server_binary_path(config)?,+ command: self.language_server_binary_path(config, worktree)?,args: vec!["lsp".to_string()],env: Default::default(),})