Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

cloud_api_types: Add settings update notifications (#65040)

Tom Houlé17d3378bb972
diff --git a/crates/client/src/llm_token.rs b/crates/client/src/llm_token.rs
index bbc53c4ed75..b6a07f21f6a 100644
--- a/crates/client/src/llm_token.rs
+++ b/crates/client/src/llm_token.rs
@@ -132,7 +132,7 @@ impl RefreshLlmTokenListener {
MessageToClient::UserUpdated => {
this.update(cx, |this, cx| this.refresh(TokenRefreshMode::Refresh, cx));
}
- MessageToClient::NotificationsUpdated => {}
+ MessageToClient::NotificationsUpdated | MessageToClient::SettingsUpdated => {}
}
}
}
diff --git a/crates/client/src/user.rs b/crates/client/src/user.rs
index fba6861828a..7a8ab595113 100644
--- a/crates/client/src/user.rs
+++ b/crates/client/src/user.rs
@@ -904,7 +904,7 @@ impl UserStore {
fn handle_message_to_client(this: WeakEntity<Self>, message: &MessageToClient, cx: &App) {
match message {
MessageToClient::UserUpdated => {}
- MessageToClient::NotificationsUpdated => return,
+ MessageToClient::NotificationsUpdated | MessageToClient::SettingsUpdated => return,
}
cx.spawn(async move |cx| {
diff --git a/crates/cloud_api_types/src/websocket_protocol.rs b/crates/cloud_api_types/src/websocket_protocol.rs
index f3f52bd5e16..db893f5ff30 100644
--- a/crates/cloud_api_types/src/websocket_protocol.rs
+++ b/crates/cloud_api_types/src/websocket_protocol.rs
@@ -14,6 +14,8 @@ pub enum MessageToClient {
UserUpdated,
/// The user's notifications were updated.
NotificationsUpdated,
+ /// The user's settings were updated and should be refreshed.
+ SettingsUpdated,
}
impl MessageToClient {
@@ -54,4 +56,13 @@ mod tests {
Ok(())
}
+
+ #[test]
+ fn settings_updated_message_round_trips_with_the_expected_wire_format() -> Result<()> {
+ let message = MessageToClient::SettingsUpdated;
+ let bytes = message.serialize()?;
+ assert_eq!(bytes, b"\x6fSettingsUpdated");
+ assert_eq!(MessageToClient::deserialize(&bytes)?, message);
+ Ok(())
+ }
}