From d6a2a0b04af07aadbc3248950b56ab083991f2ce Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Tue, 4 Feb 2025 16:02:26 -0500 Subject: [PATCH] zeta: Rename `data_collection_permission` back to `can_collect_data` (#24225) This PR renames some bindings from `data_collection_permission` back to `can_collect_data`, as the latter name is clearer on account of being a modal verb. Release Notes: - N/A --- crates/rpc/src/llm.rs | 2 +- crates/zeta/src/zeta.rs | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/crates/rpc/src/llm.rs b/crates/rpc/src/llm.rs index 93ac5bdee8..c1612662bf 100644 --- a/crates/rpc/src/llm.rs +++ b/crates/rpc/src/llm.rs @@ -41,7 +41,7 @@ pub struct PredictEditsParams { pub input_excerpt: String, /// Whether the user provided consent for sampling this interaction. #[serde(default)] - pub data_collection_permission: bool, + pub can_collect_data: bool, } #[derive(Debug, Serialize, Deserialize)] diff --git a/crates/zeta/src/zeta.rs b/crates/zeta/src/zeta.rs index c0ba581f6b..57c12d6f5c 100644 --- a/crates/zeta/src/zeta.rs +++ b/crates/zeta/src/zeta.rs @@ -364,7 +364,7 @@ impl Zeta { &mut self, buffer: &Entity, cursor: language::Anchor, - data_collection_permission: bool, + can_collect_data: bool, cx: &mut Context, perform_predict_edits: F, ) -> Task>> @@ -429,7 +429,7 @@ impl Zeta { input_events: input_events.clone(), input_excerpt: input_excerpt.clone(), outline: Some(input_outline.clone()), - data_collection_permission, + can_collect_data, }; let response = perform_predict_edits(client, llm_token, is_staff, body).await?; @@ -609,13 +609,13 @@ and then another &mut self, buffer: &Entity, position: language::Anchor, - data_collection_permission: bool, + can_collect_data: bool, cx: &mut Context, ) -> Task>> { self.request_completion_impl( buffer, position, - data_collection_permission, + can_collect_data, cx, Self::perform_predict_edits, ) @@ -1365,7 +1365,7 @@ impl ProviderDataCollection { .map_or(false, |choice| choice.read(cx).is_enabled()) } - pub fn data_collection_permission(&self, cx: &App) -> bool { + pub fn can_collect_data(&self, cx: &App) -> bool { self.choice .as_ref() .is_some_and(|choice| choice.read(cx).is_enabled()) @@ -1499,8 +1499,7 @@ impl inline_completion::InlineCompletionProvider for ZetaInlineCompletionProvide let pending_completion_id = self.next_pending_completion_id; self.next_pending_completion_id += 1; - let data_collection_permission = - self.provider_data_collection.data_collection_permission(cx); + let can_collect_data = self.provider_data_collection.can_collect_data(cx); let last_request_timestamp = self.last_request_timestamp; let task = cx.spawn(|this, mut cx| async move { @@ -1513,7 +1512,7 @@ impl inline_completion::InlineCompletionProvider for ZetaInlineCompletionProvide let completion_request = this.update(&mut cx, |this, cx| { this.last_request_timestamp = Instant::now(); this.zeta.update(cx, |zeta, cx| { - zeta.request_completion(&buffer, position, data_collection_permission, cx) + zeta.request_completion(&buffer, position, can_collect_data, cx) }) });