From 4e98048d2e5cfd56d5f9fe73ba536892afa0e130 Mon Sep 17 00:00:00 2001 From: mizdra Date: Mon, 1 Sep 2025 20:10:43 +0900 Subject: [PATCH] fix ts-plugin startup failure after update error --- crates/zed/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/zed/src/lib.rs b/crates/zed/src/lib.rs index 7f9886e7..04cb65aa 100644 --- a/crates/zed/src/lib.rs +++ b/crates/zed/src/lib.rs @@ -5,7 +5,7 @@ use zed_extension_api::{self as zed, Result, serde_json}; const TS_PLUGIN_PACKAGE_NAME: &str = "@css-modules-kit/ts-plugin"; /// Install ts-plugin in "{extension_work_dir}/node_modules" -fn install_ts_plugin_if_needed() -> Result<()> { +fn install_or_update_ts_plugin_if_needed() -> Result<()> { let installed_plugin_version = zed::npm_package_installed_version(TS_PLUGIN_PACKAGE_NAME)?; let latest_plugin_version = zed::npm_package_latest_version(TS_PLUGIN_PACKAGE_NAME)?; @@ -32,8 +32,8 @@ fn get_ts_plugin_search_location(worktree: &zed::Worktree) -> String { return worktree.root_path(); } - if let Err(_) = install_ts_plugin_if_needed() { - return worktree.root_path(); + if let Err(_) = install_or_update_ts_plugin_if_needed() { + println!("Failed to install or update ts-plugin. Please try again later.") } // The cwd for the extension is "~/Library/Application Support/Zed/extensions/work/css-modules-kit" on macOS.