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.

Subscribe to copilot events (WIP)

Joseph Lyonsf50afefed337
diff --git a/crates/copilot/src/copilot.rs b/crates/copilot/src/copilot.rs
index b9e850b3713..07c54c77857 100644
--- a/crates/copilot/src/copilot.rs
+++ b/crates/copilot/src/copilot.rs
@@ -47,9 +47,21 @@ pub fn init(http: Arc<dyn HttpClient>, node_runtime: Arc<NodeRuntime>, cx: &mut
});
cx.set_global(copilot.clone());
- //////////////////////////////////////
- // SUBSCRIBE TO COPILOT EVENTS HERE //
- //////////////////////////////////////
+ cx.subscribe(&copilot, |_, event, _| {
+ match event {
+ Event::CompletionAccepted { uuid, file_type } => {
+ // Build event object and pass it in
+ // telemetry.report_clickhouse_event(event, settings.telemetry())
+ }
+ Event::CompletionsDiscarded { uuids, file_type } => {
+ for uuid in uuids {
+ // Build event object and pass it in
+ // telemetry.report_clickhouse_event(event, settings.telemetry())
+ }
+ }
+ };
+ })
+ .detach();
cx.observe(&copilot, |handle, cx| {
let status = handle.read(cx).status();