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
This commit is contained in:
Thorsten Ball 2024-05-03 13:23:52 +02:00 committed by GitHub
parent f987ff05fd
commit 9348e6f7fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -262,7 +262,7 @@ impl LanguageServer {
let mut command = process::Command::new(&binary.path); let mut command = process::Command::new(&binary.path);
command command
.current_dir(working_dir) .current_dir(working_dir)
.args(binary.arguments) .args(&binary.arguments)
.envs(binary.env.unwrap_or_default()) .envs(binary.env.unwrap_or_default())
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stdout(Stdio::piped()) .stdout(Stdio::piped())
@ -270,7 +270,12 @@ impl LanguageServer {
.kill_on_drop(true); .kill_on_drop(true);
#[cfg(windows)] #[cfg(windows)]
command.creation_flags(windows::Win32::System::Threading::CREATE_NO_WINDOW.0); 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 stdin = server.stdin.take().unwrap();
let stdout = server.stdout.take().unwrap(); let stdout = server.stdout.take().unwrap();