From bf63ff2b9157a05985536bd4890cd9e3587f24e7 Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Wed, 22 Oct 2025 22:44:25 -0400 Subject: [PATCH] Fix path for vscode-html-language-server when found on PATH (#40832) Don't prepend the worktree root when using an absolute path from `Worktree::which`, since that does the wrong thing when running in wasmtime given two Windows absolute paths. Also don't pass this path to `node`, since when npm installed it's a sh/cmd wrapper not a JS file. Part of #39153, also needs a fix on the vscode-langservers-extracted side (missing shebang for the vscode-html-language-server script). Release Notes: - Fixed Zed failing to run the HTML language server in some cases. --- extensions/html/src/html.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/extensions/html/src/html.rs b/extensions/html/src/html.rs index 27fd2d1e222..337689ebddd 100644 --- a/extensions/html/src/html.rs +++ b/extensions/html/src/html.rs @@ -68,22 +68,24 @@ impl zed::Extension for HtmlExtension { worktree: &zed::Worktree, ) -> Result { let server_path = if let Some(path) = worktree.which(BINARY_NAME) { - path + return Ok(zed::Command { + command: path, + args: vec!["--stdio".to_string()], + env: Default::default(), + }); } else { - self.server_script_path(language_server_id)? + let server_path = self.server_script_path(language_server_id)?; + env::current_dir() + .unwrap() + .join(&server_path) + .to_string_lossy() + .to_string() }; self.cached_binary_path = Some(server_path.clone()); Ok(zed::Command { command: zed::node_binary_path()?, - args: vec![ - env::current_dir() - .unwrap() - .join(&server_path) - .to_string_lossy() - .to_string(), - "--stdio".to_string(), - ], + args: vec![server_path, "--stdio".to_string()], env: Default::default(), }) }