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