Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remove `zed-pro` feature flag (#37807)
Marshall Bowers1feffad5e8ff
diff --git a/crates/agent_ui/src/inline_prompt_editor.rs b/crates/agent_ui/src/inline_prompt_editor.rsindex d268c2f2115..b6517a54339 100644--- a/crates/agent_ui/src/inline_prompt_editor.rs+++ b/crates/agent_ui/src/inline_prompt_editor.rs@@ -1,29 +1,18 @@-use crate::agent_model_selector::AgentModelSelector;-use crate::buffer_codegen::BufferCodegen;-use crate::context_picker::{ContextPicker, ContextPickerCompletionProvider};-use crate::context_strip::{ContextStrip, ContextStripEvent, SuggestContextKind};-use crate::message_editor::{ContextCreasesAddon, extract_message_creases, insert_message_creases};-use crate::terminal_codegen::TerminalCodegen;-use crate::{CycleNextInlineAssist, CyclePreviousInlineAssist, ModelUsageContext};-use crate::{RemoveAllContext, ToggleContextPicker};use agent::{context_store::ContextStore,thread_store::{TextThreadStore, ThreadStore},};-use client::ErrorExt;use collections::VecDeque;-use db::kvp::Dismissable;use editor::actions::Paste;use editor::display_map::EditorMargins;use editor::{ContextMenuOptions, Editor, EditorElement, EditorEvent, EditorMode, EditorStyle, MultiBuffer,actions::{MoveDown, MoveUp},};-use feature_flags::{FeatureFlagAppExt as _, ZedProFeatureFlag};use fs::Fs;use gpui::{- AnyElement, App, ClickEvent, Context, CursorStyle, Entity, EventEmitter, FocusHandle,- Focusable, FontWeight, Subscription, TextStyle, WeakEntity, Window, anchored, deferred, point,+ AnyElement, App, Context, CursorStyle, Entity, EventEmitter, FocusHandle, Focusable,+ Subscription, TextStyle, WeakEntity, Window,};use language_model::{LanguageModel, LanguageModelRegistry};use parking_lot::Mutex;@@ -33,12 +22,19 @@ use std::rc::Rc;use std::sync::Arc;use theme::ThemeSettings;use ui::utils::WithRemSize;-use ui::{- CheckboxWithLabel, IconButtonShape, KeyBinding, Popover, PopoverMenuHandle, Tooltip, prelude::*,-};+use ui::{IconButtonShape, KeyBinding, PopoverMenuHandle, Tooltip, prelude::*};use workspace::Workspace;use zed_actions::agent::ToggleModelSelector;+use crate::agent_model_selector::AgentModelSelector;+use crate::buffer_codegen::BufferCodegen;+use crate::context_picker::{ContextPicker, ContextPickerCompletionProvider};+use crate::context_strip::{ContextStrip, ContextStripEvent, SuggestContextKind};+use crate::message_editor::{ContextCreasesAddon, extract_message_creases, insert_message_creases};+use crate::terminal_codegen::TerminalCodegen;+use crate::{CycleNextInlineAssist, CyclePreviousInlineAssist, ModelUsageContext};+use crate::{RemoveAllContext, ToggleContextPicker};+pub struct PromptEditor<T> {pub editor: Entity<Editor>,mode: PromptEditorMode,@@ -144,47 +140,16 @@ impl<T: 'static> Render for PromptEditor<T> {};let error_message = SharedString::from(error.to_string());- if error.error_code() == proto::ErrorCode::RateLimitExceeded- && cx.has_flag::<ZedProFeatureFlag>()- {- el.child(- v_flex()- .child(- IconButton::new(- "rate-limit-error",- IconName::XCircle,- )- .toggle_state(self.show_rate_limit_notice)- .shape(IconButtonShape::Square)- .icon_size(IconSize::Small)- .on_click(- cx.listener(Self::toggle_rate_limit_notice),- ),- )- .children(self.show_rate_limit_notice.then(|| {- deferred(- anchored()- .position_mode(- gpui::AnchoredPositionMode::Local,- )- .position(point(px(0.), px(24.)))- .anchor(gpui::Corner::TopLeft)- .child(self.render_rate_limit_notice(cx)),- )- })),- )- } else {- el.child(- div()- .id("error")- .tooltip(Tooltip::text(error_message))- .child(- Icon::new(IconName::XCircle)- .size(IconSize::Small)- .color(Color::Error),- ),- )- }+ el.child(+ div()+ .id("error")+ .tooltip(Tooltip::text(error_message))+ .child(+ Icon::new(IconName::XCircle)+ .size(IconSize::Small)+ .color(Color::Error),+ ),+ )}),).child(@@ -310,19 +275,6 @@ impl<T: 'static> PromptEditor<T> {crate::active_thread::attach_pasted_images_as_context(&self.context_store, cx);}- fn toggle_rate_limit_notice(- &mut self,- _: &ClickEvent,- window: &mut Window,- cx: &mut Context<Self>,- ) {- self.show_rate_limit_notice = !self.show_rate_limit_notice;- if self.show_rate_limit_notice {- window.focus(&self.editor.focus_handle(cx));- }- cx.notify();- }-fn handle_prompt_editor_events(&mut self,_: &Entity<Editor>,@@ -707,61 +659,6 @@ impl<T: 'static> PromptEditor<T> {.into_any_element()}- fn render_rate_limit_notice(&self, cx: &mut Context<Self>) -> impl IntoElement {- Popover::new().child(- v_flex()- .occlude()- .p_2()- .child(- Label::new("Out of Tokens")- .size(LabelSize::Small)- .weight(FontWeight::BOLD),- )- .child(Label::new(- "Try Zed Pro for higher limits, a wider range of models, and more.",- ))- .child(- h_flex()- .justify_between()- .child(CheckboxWithLabel::new(- "dont-show-again",- Label::new("Don't show again"),- if RateLimitNotice::dismissed() {- ui::ToggleState::Selected- } else {- ui::ToggleState::Unselected- },- |selection, _, cx| {- let is_dismissed = match selection {- ui::ToggleState::Unselected => false,- ui::ToggleState::Indeterminate => return,- ui::ToggleState::Selected => true,- };-- RateLimitNotice::set_dismissed(is_dismissed, cx);- },- ))- .child(- h_flex()- .gap_2()- .child(- Button::new("dismiss", "Dismiss")- .style(ButtonStyle::Transparent)- .on_click(cx.listener(Self::toggle_rate_limit_notice)),- )- .child(Button::new("more-info", "More Info").on_click(- |_event, window, cx| {- window.dispatch_action(- Box::new(zed_actions::OpenAccountSettings),- cx,- )- },- )),- ),- ),- )- }-fn render_editor(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> AnyElement {let colors = cx.theme().colors();@@ -978,15 +875,7 @@ impl PromptEditor<BufferCodegen> {self.editor.update(cx, |editor, _| editor.set_read_only(false));}- CodegenStatus::Error(error) => {- if cx.has_flag::<ZedProFeatureFlag>()- && error.error_code() == proto::ErrorCode::RateLimitExceeded- && !RateLimitNotice::dismissed()- {- self.show_rate_limit_notice = true;- cx.notify();- }-+ CodegenStatus::Error(_error) => {self.edited_since_done = false;self.editor.update(cx, |editor, _| editor.set_read_only(false));@@ -1189,12 +1078,6 @@ impl PromptEditor<TerminalCodegen> {}}-struct RateLimitNotice;--impl Dismissable for RateLimitNotice {- const KEY: &'static str = "dismissed-rate-limit-notice";-}-pub enum CodegenStatus {Idle,Pending,diff --git a/crates/agent_ui/src/language_model_selector.rs b/crates/agent_ui/src/language_model_selector.rsindex 3633e533da9..eb5a734b4ca 100644--- a/crates/agent_ui/src/language_model_selector.rs+++ b/crates/agent_ui/src/language_model_selector.rs@@ -1,8 +1,6 @@use std::{cmp::Reverse, sync::Arc};-use cloud_llm_client::Plan;use collections::{HashSet, IndexMap};-use feature_flags::ZedProFeatureFlag;use fuzzy::{StringMatch, StringMatchCandidate, match_strings};use gpui::{Action, AnyElement, App, BackgroundExecutor, DismissEvent, Subscription, Task};use language_model::{@@ -13,8 +11,6 @@ use ordered_float::OrderedFloat;use picker::{Picker, PickerDelegate};use ui::{ListItem, ListItemSpacing, prelude::*};-const TRY_ZED_PRO_URL: &str = "https://zed.dev/pro";-type OnModelChanged = Arc<dyn Fn(Arc<dyn LanguageModel>, &mut App) + 'static>;type GetActiveModel = Arc<dyn Fn(&App) -> Option<ConfiguredModel> + 'static>;@@ -531,13 +527,9 @@ impl PickerDelegate for LanguageModelPickerDelegate {fn render_footer(&self,- _: &mut Window,+ _window: &mut Window,cx: &mut Context<Picker<Self>>,) -> Option<gpui::AnyElement> {- use feature_flags::FeatureFlagAppExt;-- let plan = Plan::ZedPro;-Some(h_flex().w_full()@@ -546,28 +538,6 @@ impl PickerDelegate for LanguageModelPickerDelegate {.p_1().gap_4().justify_between()- .when(cx.has_flag::<ZedProFeatureFlag>(), |this| {- this.child(match plan {- Plan::ZedPro => Button::new("zed-pro", "Zed Pro")- .icon(IconName::ZedAssistant)- .icon_size(IconSize::Small)- .icon_color(Color::Muted)- .icon_position(IconPosition::Start)- .on_click(|_, window, cx| {- window- .dispatch_action(Box::new(zed_actions::OpenAccountSettings), cx)- }),- Plan::ZedFree | Plan::ZedProTrial => Button::new(- "try-pro",- if plan == Plan::ZedProTrial {- "Upgrade to Pro"- } else {- "Try Pro"- },- )- .on_click(|_, _, cx| cx.open_url(TRY_ZED_PRO_URL)),- })- }).child(Button::new("configure", "Configure").icon(IconName::Settings)diff --git a/crates/feature_flags/src/feature_flags.rs b/crates/feature_flags/src/feature_flags.rsindex b9e9f3ae9f3..2f609f51ab7 100644--- a/crates/feature_flags/src/feature_flags.rs+++ b/crates/feature_flags/src/feature_flags.rs@@ -66,11 +66,6 @@ impl FeatureFlag for LlmClosedBetaFeatureFlag {const NAME: &'static str = "llm-closed-beta";}-pub struct ZedProFeatureFlag {}-impl FeatureFlag for ZedProFeatureFlag {- const NAME: &'static str = "zed-pro";-}-pub struct NotebookFeatureFlag;impl FeatureFlag for NotebookFeatureFlag {