From 9348e6f7fb7f98cd0835dc5a5219967c14268ea7 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Fri, 3 May 2024 13:23:52 +0200 Subject: [PATCH] lsp: More information in error if server fails to start (#11343) We do log that information, but we don't put it in the error message where it's really useful. Release Notes: - N/A --- crates/lsp/src/lsp.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/lsp/src/lsp.rs b/crates/lsp/src/lsp.rs index 65294974e7d172fe170dab95e3d023a5b37d114e..7981922d3dd97d65120ac06f96fb7f906d423ff2 100644 --- a/crates/lsp/src/lsp.rs +++ b/crates/lsp/src/lsp.rs @@ -262,7 +262,7 @@ impl LanguageServer { let mut command = process::Command::new(&binary.path); command .current_dir(working_dir) - .args(binary.arguments) + .args(&binary.arguments) .envs(binary.env.unwrap_or_default()) .stdin(Stdio::piped()) .stdout(Stdio::piped()) @@ -270,7 +270,12 @@ impl LanguageServer { .kill_on_drop(true); #[cfg(windows)] command.creation_flags(windows::Win32::System::Threading::CREATE_NO_WINDOW.0); - let mut server = command.spawn()?; + let mut server = command.spawn().with_context(|| { + format!( + "failed to spawn command. path: {:?}, working directory: {:?}, args: {:?}", + binary.path, working_dir, &binary.arguments + ) + })?; let stdin = server.stdin.take().unwrap(); let stdout = server.stdout.take().unwrap();