From e6d08e4e1b4b28cbe9a147a1202d7c93ceb8f6f8 Mon Sep 17 00:00:00 2001 From: someone120 Date: Fri, 3 Jan 2025 11:01:39 +0800 Subject: [PATCH] Fix leading slash on windows (#20559) --- crates/language_extension/src/extension_lsp_adapter.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/language_extension/src/extension_lsp_adapter.rs b/crates/language_extension/src/extension_lsp_adapter.rs index 3286e09e2d6ff..b1af283dd337b 100644 --- a/crates/language_extension/src/extension_lsp_adapter.rs +++ b/crates/language_extension/src/extension_lsp_adapter.rs @@ -152,10 +152,15 @@ impl LspAdapter for ExtensionLspAdapter { .context("failed to set file permissions")?; } } - + let mut arguments = command.args; + #[cfg(target_os = "windows")] + { + arguments[0] = arguments[0].trim_start_matches("/").to_string(); + } + let arguments = arguments.into_iter().map(|arg| arg.into()).collect(); Ok(LanguageServerBinary { path, - arguments: command.args.into_iter().map(|arg| arg.into()).collect(), + arguments, env: Some(command.env.into_iter().collect()), }) }