diff --git a/crates/ruff_server/src/server/api.rs b/crates/ruff_server/src/server/api.rs index d649379d48317..38166fdf68795 100644 --- a/crates/ruff_server/src/server/api.rs +++ b/crates/ruff_server/src/server/api.rs @@ -55,6 +55,7 @@ pub(super) fn request<'a>(req: server::Request) -> Task<'a> { } .unwrap_or_else(|err| { tracing::error!("Encountered error when routing request with ID {id}: {err}"); + show_err_msg!("Ruff failed to handle a request from the editor. Check the error log for more details."); let result: Result<()> = Err(err); Task::immediate(id, result) }) @@ -84,6 +85,7 @@ pub(super) fn notification<'a>(notif: server::Notification) -> Task<'a> { } .unwrap_or_else(|err| { tracing::error!("Encountered error when routing notification: {err}"); + show_err_msg!("Ruff failed to handle a notification from the editor. Check the error log for more details."); Task::nothing() }) } @@ -122,6 +124,7 @@ fn local_notification_task<'a, N: traits::SyncNotificationHandler>( Ok(Task::local(move |session, notifier, _, _| { if let Err(err) = N::run(session, notifier, params) { tracing::error!("An error occurred while running {id}: {err}"); + show_err_msg!("Ruff encountered a problem. Check the error log for more details."); } })) } @@ -140,6 +143,7 @@ fn background_notification_thread<'a, N: traits::BackgroundDocumentNotificationH Box::new(move |notifier, _| { if let Err(err) = N::run_with_snapshot(snapshot, notifier, params) { tracing::error!("An error occurred while running {id}: {err}"); + show_err_msg!("Ruff encountered a problem. Check the error log for more details."); } }) })) @@ -182,6 +186,10 @@ fn respond( ) where Req: traits::RequestHandler, { + if let Err(err) = &result { + tracing::error!("An error occurred with result ID {id}: {err}"); + show_err_msg!("Ruff encountered a problem. Check the error log for more details."); + } if let Err(err) = responder.respond(id, result) { tracing::error!("Failed to send response: {err}"); } diff --git a/crates/ruff_server/src/server/api/requests/execute_command.rs b/crates/ruff_server/src/server/api/requests/execute_command.rs index c8cdb7fdec05a..28b309b5978e0 100644 --- a/crates/ruff_server/src/server/api/requests/execute_command.rs +++ b/crates/ruff_server/src/server/api/requests/execute_command.rs @@ -145,7 +145,8 @@ fn apply_edit( let reason = response .failure_reason .unwrap_or_else(|| String::from("unspecified reason")); - tracing::error!("Failed to apply workspace edit: {}", reason); + tracing::error!("Failed to apply workspace edit: {reason}"); + show_err_msg!("Ruff was unable to apply edits: {reason}"); } Task::nothing() }, diff --git a/crates/ruff_server/src/session/settings.rs b/crates/ruff_server/src/session/settings.rs index a29692a63c419..de30b922d75cf 100644 --- a/crates/ruff_server/src/session/settings.rs +++ b/crates/ruff_server/src/session/settings.rs @@ -100,6 +100,7 @@ impl AllSettings { serde_json::from_value(options) .map_err(|err| { tracing::error!("Failed to deserialize initialization options: {err}. Falling back to default client settings..."); + show_err_msg!("Ruff received invalid client settings - falling back to default client settings."); }) .unwrap_or_default(), )