project: Print error causes when failing to spawn lsp command (#36163)

cc https://github.com/zed-industries/zed/issues/34666

Display printing anyhow errors only renders the error itself, but not
any of its causes so we've been dropping the important context when
showing the issue to the users.

Release Notes:

- N/A
This commit is contained in:
Lukas Wirth
2025-08-14 08:16:25 +00:00
committed by GitHub
parent 0291db0d78
commit 8e4f30abcb
2 changed files with 11 additions and 7 deletions
+9 -5
View File
@@ -390,13 +390,17 @@ impl LocalLspStore {
delegate.update_status(
adapter.name(),
BinaryStatus::Failed {
error: format!("{err}\n-- stderr--\n{log}"),
error: if log.is_empty() {
format!("{err:#}")
} else {
format!("{err:#}\n-- stderr --\n{log}")
},
},
);
let message =
format!("Failed to start language server {server_name:?}: {err:#?}");
log::error!("{message}");
log::error!("server stderr: {log}");
log::error!("Failed to start language server {server_name:?}: {err:?}");
if !log.is_empty() {
log::error!("server stderr: {log}");
}
None
}
}