From 8e7c145f2000873b4b3743c40c66db7ab7ec66f9 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Tue, 22 Apr 2025 17:16:54 -0400 Subject: [PATCH] inline_completion_button: Show the usage limits returned from the API (#29239) This PR updates the usage meter for edit predictions to use the limits returned from the API instead of basing it off the plan. This will allow limits to be updated from the server rather than being embedded in the client. Release Notes: - N/A --- .../src/inline_completion_button.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/inline_completion_button/src/inline_completion_button.rs b/crates/inline_completion_button/src/inline_completion_button.rs index e4ea9566e7..a00d347801 100644 --- a/crates/inline_completion_button/src/inline_completion_button.rs +++ b/crates/inline_completion_button/src/inline_completion_button.rs @@ -34,7 +34,7 @@ use workspace::{ notifications::NotificationId, }; use zed_actions::OpenBrowser; -use zed_llm_client::{Plan, UsageLimit}; +use zed_llm_client::UsageLimit; use zeta::RateCompletions; actions!(edit_prediction, [ToggleMenu]); @@ -408,10 +408,7 @@ impl InlineCompletionButton { menu = menu.header("Usage"); menu = menu.custom_entry( move |_window, cx| { - let plan = Plan::ZedProTrial; - let edit_predictions_limit = plan.edit_predictions_limit(); - - let used_percentage = match edit_predictions_limit { + let used_percentage = match usage.limit { UsageLimit::Limited(limit) => { Some((usage.amount as f32 / limit as f32) * 100.) } @@ -426,7 +423,7 @@ impl InlineCompletionButton { .map(|percent| ProgressBar::new("usage", percent, 100., cx)), ) .child( - Label::new(match edit_predictions_limit { + Label::new(match usage.limit { UsageLimit::Limited(limit) => { format!("{} / {limit}", usage.amount) }