Reduce spamming of inline completion discard events (#11999)

I'm not a huge fan of passing around a boolean all around the place, but
this will tame the events for now until we have a better solution.

Release Notes:

- N/A
This commit is contained in:
Joseph T. Lyons 2024-05-17 16:37:17 -04:00 committed by GitHub
parent 99c6389ff8
commit e5a4421559
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 57 additions and 42 deletions

View file

@ -100,8 +100,8 @@ impl InlineCompletionProvider for SupermavenCompletionProvider {
}
fn accept(&mut self, _cx: &mut ModelContext<Self>) {
if let Some(telemetry) = self.telemetry.as_ref() {
if let Some(_) = self.completion_id {
if self.completion_id.is_some() {
if let Some(telemetry) = self.telemetry.as_ref() {
telemetry.report_inline_completion_event(
Self::name().to_string(),
true,
@ -113,14 +113,20 @@ impl InlineCompletionProvider for SupermavenCompletionProvider {
self.completion_id = None;
}
fn discard(&mut self, _cx: &mut ModelContext<Self>) {
if let Some(telemetry) = self.telemetry.as_ref() {
if let Some(_) = self.completion_id {
telemetry.report_inline_completion_event(
Self::name().to_string(),
false,
self.file_extension.clone(),
);
fn discard(
&mut self,
should_report_inline_completion_event: bool,
_cx: &mut ModelContext<Self>,
) {
if should_report_inline_completion_event {
if self.completion_id.is_some() {
if let Some(telemetry) = self.telemetry.as_ref() {
telemetry.report_inline_completion_event(
Self::name().to_string(),
false,
self.file_extension.clone(),
);
}
}
}