Don't make events for every rejected suggestion

This commit is contained in:
Joseph Lyons 2023-05-16 17:19:05 -04:00
parent afe75e8cbd
commit ffd503951b
2 changed files with 4 additions and 6 deletions

View file

@ -87,7 +87,7 @@ pub enum ClickhouseEvent {
copilot_enabled_for_language: bool, copilot_enabled_for_language: bool,
}, },
Copilot { Copilot {
suggestion_id: String, suggestion_id: Option<String>,
suggestion_accepted: bool, suggestion_accepted: bool,
file_extension: Option<String>, file_extension: Option<String>,
}, },

View file

@ -3098,7 +3098,7 @@ impl Editor {
.update(cx, |copilot, cx| copilot.accept_completion(completion, cx)) .update(cx, |copilot, cx| copilot.accept_completion(completion, cx))
.detach_and_log_err(cx); .detach_and_log_err(cx);
self.report_copilot_event(completion.uuid.clone(), true, cx) self.report_copilot_event(Some(completion.uuid.clone()), true, cx)
} }
self.insert_with_autoindent_mode(&suggestion.text.to_string(), None, cx); self.insert_with_autoindent_mode(&suggestion.text.to_string(), None, cx);
cx.notify(); cx.notify();
@ -3117,9 +3117,7 @@ impl Editor {
}) })
.detach_and_log_err(cx); .detach_and_log_err(cx);
for completion in &self.copilot_state.completions { self.report_copilot_event(None, false, cx)
self.report_copilot_event(completion.uuid.clone(), false, cx)
}
} }
self.display_map self.display_map
@ -6884,7 +6882,7 @@ impl Editor {
fn report_copilot_event( fn report_copilot_event(
&self, &self,
suggestion_id: String, suggestion_id: Option<String>,
suggestion_accepted: bool, suggestion_accepted: bool,
cx: &AppContext, cx: &AppContext,
) { ) {