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.

inline_completion_button: Show the usage limits returned from the API (#29239)

Marshall Bowers8e7c145f2000
diff --git a/crates/inline_completion_button/src/inline_completion_button.rs b/crates/inline_completion_button/src/inline_completion_button.rs
index e4ea9566e73..a00d347801f 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)
}