diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index 1bf02a6e37..b8beef5f25 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -156,7 +156,10 @@ impl Server { let envelope = envelope.into_any().downcast::>().unwrap(); let span = info_span!( "handle message", - payload_type = envelope.payload_type_name() + payload_type = envelope.payload_type_name(), + payload = serde_json::to_string_pretty(&envelope.payload) + .unwrap() + .as_str(), ); let future = (handler)(server, *envelope); async move { diff --git a/crates/rpc/build.rs b/crates/rpc/build.rs index d453616095..66b289f1db 100644 --- a/crates/rpc/build.rs +++ b/crates/rpc/build.rs @@ -2,6 +2,7 @@ fn main() { let mut build = prost_build::Config::new(); // build.protoc_arg("--experimental_allow_proto3_optional"); build + .type_attribute(".", "#[derive(serde::Serialize)]") .compile_protos(&["proto/zed.proto"], &["proto"]) .unwrap(); } diff --git a/crates/rpc/src/proto.rs b/crates/rpc/src/proto.rs index 2d3bf639f4..98fc493774 100644 --- a/crates/rpc/src/proto.rs +++ b/crates/rpc/src/proto.rs @@ -3,6 +3,7 @@ use anyhow::{anyhow, Result}; use async_tungstenite::tungstenite::Message as WebSocketMessage; use futures::{SinkExt as _, StreamExt as _}; use prost::Message as _; +use serde::Serialize; use std::any::{Any, TypeId}; use std::{ io, @@ -11,7 +12,7 @@ use std::{ include!(concat!(env!("OUT_DIR"), "/zed.messages.rs")); -pub trait EnvelopedMessage: Clone + Sized + Send + Sync + 'static { +pub trait EnvelopedMessage: Clone + Serialize + Sized + Send + Sync + 'static { const NAME: &'static str; const PRIORITY: MessagePriority; fn into_envelope(