Skip to content

Commit 187f851

Browse files
authored
feature_flags: Add FeatureFlag suffix to feature flag types (zed-industries#29392)
This PR adds the `FeatureFlag` suffix to the feature flag types that were missing them. This makes the names easier to search in the codebase. Release Notes: - N/A
1 parent a77db45 commit 187f851

File tree

13 files changed

+40
-40
lines changed

13 files changed

+40
-40
lines changed

crates/agent/src/inline_prompt_editor.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use editor::{
1313
Editor, EditorElement, EditorEvent, EditorMode, EditorStyle, GutterDimensions, MultiBuffer,
1414
actions::{MoveDown, MoveUp},
1515
};
16-
use feature_flags::{FeatureFlagAppExt as _, ZedPro};
16+
use feature_flags::{FeatureFlagAppExt as _, ZedProFeatureFlag};
1717
use fs::Fs;
1818
use gpui::{
1919
AnyElement, App, ClickEvent, Context, CursorStyle, Entity, EventEmitter, FocusHandle,
@@ -132,7 +132,7 @@ impl<T: 'static> Render for PromptEditor<T> {
132132

133133
let error_message = SharedString::from(error.to_string());
134134
if error.error_code() == proto::ErrorCode::RateLimitExceeded
135-
&& cx.has_flag::<ZedPro>()
135+
&& cx.has_flag::<ZedProFeatureFlag>()
136136
{
137137
el.child(
138138
v_flex()
@@ -931,7 +931,7 @@ impl PromptEditor<BufferCodegen> {
931931
.update(cx, |editor, _| editor.set_read_only(false));
932932
}
933933
CodegenStatus::Error(error) => {
934-
if cx.has_flag::<ZedPro>()
934+
if cx.has_flag::<ZedProFeatureFlag>()
935935
&& error.error_code() == proto::ErrorCode::RateLimitExceeded
936936
&& !dismissed_rate_limit_notice()
937937
{

crates/agent/src/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2097,7 +2097,7 @@ impl Thread {
20972097
}
20982098

20992099
pub fn auto_capture_telemetry(&mut self, cx: &mut Context<Self>) {
2100-
if !cx.has_flag::<feature_flags::ThreadAutoCapture>() {
2100+
if !cx.has_flag::<feature_flags::ThreadAutoCaptureFeatureFlag>() {
21012101
return;
21022102
}
21032103

crates/assistant/src/inline_assistant.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use editor::{
1818
},
1919
};
2020
use feature_flags::{
21-
Assistant2FeatureFlag, FeatureFlagAppExt as _, FeatureFlagViewExt as _, ZedPro,
21+
Assistant2FeatureFlag, FeatureFlagAppExt as _, FeatureFlagViewExt as _, ZedProFeatureFlag,
2222
};
2323
use fs::Fs;
2424
use futures::{
@@ -1652,7 +1652,7 @@ impl Render for PromptEditor {
16521652

16531653
let error_message = SharedString::from(error.to_string());
16541654
if error.error_code() == proto::ErrorCode::RateLimitExceeded
1655-
&& cx.has_flag::<ZedPro>()
1655+
&& cx.has_flag::<ZedProFeatureFlag>()
16561656
{
16571657
el.child(
16581658
v_flex()
@@ -1966,7 +1966,7 @@ impl PromptEditor {
19661966
.update(cx, |editor, _| editor.set_read_only(false));
19671967
}
19681968
CodegenStatus::Error(error) => {
1969-
if cx.has_flag::<ZedPro>()
1969+
if cx.has_flag::<ZedProFeatureFlag>()
19701970
&& error.error_code() == proto::ErrorCode::RateLimitExceeded
19711971
&& !dismissed_rate_limit_notice()
19721972
{

crates/debugger_ui/src/debugger_ui.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use dap::debugger_settings::DebuggerSettings;
22
use debugger_panel::{DebugPanel, ToggleFocus};
33
use editor::Editor;
4-
use feature_flags::{Debugger, FeatureFlagViewExt};
4+
use feature_flags::{DebuggerFeatureFlag, FeatureFlagViewExt};
55
use gpui::{App, EntityInputHandler, actions};
66
use new_session_modal::NewSessionModal;
77
use project::debugger::{self, breakpoint_store::SourceBreakpoint};
@@ -47,7 +47,7 @@ pub fn init(cx: &mut App) {
4747
return;
4848
};
4949

50-
cx.when_flag_enabled::<Debugger>(window, |workspace, _, _| {
50+
cx.when_flag_enabled::<DebuggerFeatureFlag>(window, |workspace, _, _| {
5151
workspace
5252
.register_action(|workspace, _: &ToggleFocus, window, cx| {
5353
workspace.toggle_panel_focus::<DebugPanel>(window, cx);

crates/editor/src/code_context_menus.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use feature_flags::{Debugger, FeatureFlagAppExt as _};
1+
use feature_flags::{DebuggerFeatureFlag, FeatureFlagAppExt as _};
22
use fuzzy::{StringMatch, StringMatchCandidate};
33
use gpui::{
44
AnyElement, BackgroundExecutor, Entity, Focusable, FontWeight, ListSizingBehavior,
@@ -812,7 +812,7 @@ impl CodeActionContents {
812812
actions: Option<Rc<[AvailableCodeAction]>>,
813813
cx: &App,
814814
) -> Self {
815-
if !cx.has_flag::<Debugger>() {
815+
if !cx.has_flag::<DebuggerFeatureFlag>() {
816816
if let Some(tasks) = &mut tasks {
817817
tasks
818818
.templates

crates/editor/src/editor.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ use element::{AcceptEditPredictionBinding, LineWithInvisibles, PositionMap, layo
7171
pub use element::{
7272
CursorLayout, EditorElement, HighlightedRange, HighlightedRangeLine, PointForPosition,
7373
};
74-
use feature_flags::{Debugger, FeatureFlagAppExt};
74+
use feature_flags::{DebuggerFeatureFlag, FeatureFlagAppExt};
7575
use futures::{
7676
FutureExt,
7777
future::{self, Shared, join},
@@ -5159,7 +5159,7 @@ impl Editor {
51595159
Self::build_tasks_context(&project, &buffer, buffer_row, tasks, cx)
51605160
});
51615161

5162-
let debugger_flag = cx.has_flag::<Debugger>();
5162+
let debugger_flag = cx.has_flag::<DebuggerFeatureFlag>();
51635163

51645164
Some(cx.spawn_in(window, async move |editor, cx| {
51655165
let task_context = match task_context {
@@ -9150,7 +9150,7 @@ impl Editor {
91509150
window: &mut Window,
91519151
cx: &mut Context<Self>,
91529152
) {
9153-
if !cx.has_flag::<Debugger>() {
9153+
if !cx.has_flag::<DebuggerFeatureFlag>() {
91549154
return;
91559155
}
91569156
let source = self

crates/editor/src/element.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use crate::{
3030
use buffer_diff::{DiffHunkStatus, DiffHunkStatusKind};
3131
use client::ParticipantIndex;
3232
use collections::{BTreeMap, HashMap};
33-
use feature_flags::{Debugger, FeatureFlagAppExt};
33+
use feature_flags::{DebuggerFeatureFlag, FeatureFlagAppExt};
3434
use file_icons::FileIcons;
3535
use git::{
3636
Oid,
@@ -547,7 +547,7 @@ impl EditorElement {
547547
register_action(editor, window, Editor::insert_uuid_v4);
548548
register_action(editor, window, Editor::insert_uuid_v7);
549549
register_action(editor, window, Editor::open_selections_in_multibuffer);
550-
if cx.has_flag::<Debugger>() {
550+
if cx.has_flag::<DebuggerFeatureFlag>() {
551551
register_action(editor, window, Editor::toggle_breakpoint);
552552
register_action(editor, window, Editor::edit_log_breakpoint);
553553
register_action(editor, window, Editor::enable_breakpoint);
@@ -7037,7 +7037,7 @@ impl Element for EditorElement {
70377037
let mut breakpoint_rows = self.editor.update(cx, |editor, cx| {
70387038
editor.active_breakpoints(start_row..end_row, window, cx)
70397039
});
7040-
if cx.has_flag::<Debugger>() {
7040+
if cx.has_flag::<DebuggerFeatureFlag>() {
70417041
for display_row in breakpoint_rows.keys() {
70427042
active_rows.entry(*display_row).or_default().breakpoint = true;
70437043
}
@@ -7060,7 +7060,7 @@ impl Element for EditorElement {
70607060
// We add the gutter breakpoint indicator to breakpoint_rows after painting
70617061
// line numbers so we don't paint a line number debug accent color if a user
70627062
// has their mouse over that line when a breakpoint isn't there
7063-
if cx.has_flag::<Debugger>() {
7063+
if cx.has_flag::<DebuggerFeatureFlag>() {
70647064
let gutter_breakpoint_indicator =
70657065
self.editor.read(cx).gutter_breakpoint_indicator.0;
70667066
if let Some((gutter_breakpoint_point, _)) =
@@ -7576,7 +7576,7 @@ impl Element for EditorElement {
75767576
let show_breakpoints = snapshot
75777577
.show_breakpoints
75787578
.unwrap_or(gutter_settings.breakpoints);
7579-
let breakpoints = if cx.has_flag::<Debugger>() && show_breakpoints {
7579+
let breakpoints = if cx.has_flag::<DebuggerFeatureFlag>() && show_breakpoints {
75807580
self.layout_breakpoints(
75817581
line_height,
75827582
start_row..end_row,

crates/feature_flags/src/feature_flags.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ impl FeatureFlag for PredictEditsRateCompletionsFeatureFlag {
6464
const NAME: &'static str = "predict-edits-rate-completions";
6565
}
6666

67-
pub struct LanguageModels {}
68-
impl FeatureFlag for LanguageModels {
67+
pub struct LanguageModelsFeatureFlag {}
68+
impl FeatureFlag for LanguageModelsFeatureFlag {
6969
const NAME: &'static str = "language-models";
7070
}
7171

72-
pub struct LlmClosedBeta {}
73-
impl FeatureFlag for LlmClosedBeta {
72+
pub struct LlmClosedBetaFeatureFlag {}
73+
impl FeatureFlag for LlmClosedBetaFeatureFlag {
7474
const NAME: &'static str = "llm-closed-beta";
7575
}
7676

77-
pub struct ZedPro {}
78-
impl FeatureFlag for ZedPro {
77+
pub struct ZedProFeatureFlag {}
78+
impl FeatureFlag for ZedProFeatureFlag {
7979
const NAME: &'static str = "zed-pro";
8080
}
8181

@@ -85,13 +85,13 @@ impl FeatureFlag for NotebookFeatureFlag {
8585
const NAME: &'static str = "notebooks";
8686
}
8787

88-
pub struct Debugger {}
89-
impl FeatureFlag for Debugger {
88+
pub struct DebuggerFeatureFlag {}
89+
impl FeatureFlag for DebuggerFeatureFlag {
9090
const NAME: &'static str = "debugger";
9191
}
9292

93-
pub struct ThreadAutoCapture {}
94-
impl FeatureFlag for ThreadAutoCapture {
93+
pub struct ThreadAutoCaptureFeatureFlag {}
94+
impl FeatureFlag for ThreadAutoCaptureFeatureFlag {
9595
const NAME: &'static str = "thread-auto-capture";
9696

9797
fn enabled_for_staff() -> bool {

crates/language_model_selector/src/language_model_selector.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::sync::Arc;
22

33
use collections::{HashSet, IndexMap};
4-
use feature_flags::{Assistant2FeatureFlag, ZedPro};
4+
use feature_flags::{Assistant2FeatureFlag, ZedProFeatureFlag};
55
use gpui::{
66
Action, AnyElement, AnyView, App, Corner, DismissEvent, Entity, EventEmitter, FocusHandle,
77
Focusable, Subscription, Task, WeakEntity, action_with_deprecated_aliases,
@@ -584,7 +584,7 @@ impl PickerDelegate for LanguageModelPickerDelegate {
584584
.p_1()
585585
.gap_4()
586586
.justify_between()
587-
.when(cx.has_flag::<ZedPro>(), |this| {
587+
.when(cx.has_flag::<ZedProFeatureFlag>(), |this| {
588588
this.child(match plan {
589589
Plan::ZedPro => Button::new("zed-pro", "Zed Pro")
590590
.icon(IconName::ZedAssistant)

crates/language_models/src/language_models.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn register_language_model_providers(
7171
);
7272
registry.register_provider(CopilotChatLanguageModelProvider::new(cx), cx);
7373

74-
cx.observe_flag::<feature_flags::LanguageModels, _>(move |enabled, cx| {
74+
cx.observe_flag::<feature_flags::LanguageModelsFeatureFlag, _>(move |enabled, cx| {
7575
let user_store = user_store.clone();
7676
let client = client.clone();
7777
LanguageModelRegistry::global(cx).update(cx, move |registry, cx| {

crates/language_models/src/provider/cloud.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use anthropic::{AnthropicError, AnthropicModelMode, parse_prompt_too_long};
22
use anyhow::{Result, anyhow};
33
use client::{Client, UserStore, zed_urls};
44
use collections::BTreeMap;
5-
use feature_flags::{FeatureFlagAppExt, LlmClosedBeta, ZedPro};
5+
use feature_flags::{FeatureFlagAppExt, LlmClosedBetaFeatureFlag, ZedProFeatureFlag};
66
use futures::{
77
AsyncBufReadExt, FutureExt, Stream, StreamExt, TryStreamExt as _, future::BoxFuture,
88
stream::BoxStream,
@@ -324,7 +324,7 @@ impl LanguageModelProvider for CloudLanguageModelProvider {
324324
);
325325
}
326326

327-
let llm_closed_beta_models = if cx.has_flag::<LlmClosedBeta>() {
327+
let llm_closed_beta_models = if cx.has_flag::<LlmClosedBetaFeatureFlag>() {
328328
zed_cloud_provider_additional_models()
329329
} else {
330330
&[]
@@ -945,7 +945,7 @@ impl Render for ConfigurationView {
945945
),
946946
),
947947
)
948-
} else if cx.has_flag::<ZedPro>() {
948+
} else if cx.has_flag::<ZedProFeatureFlag>() {
949949
Some(
950950
h_flex()
951951
.gap_2()

crates/title_bar/src/title_bar.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::platforms::{platform_linux, platform_mac, platform_windows};
1818
use auto_update::AutoUpdateStatus;
1919
use call::ActiveCall;
2020
use client::{Client, UserStore};
21-
use feature_flags::{FeatureFlagAppExt, ZedPro};
21+
use feature_flags::{FeatureFlagAppExt, ZedProFeatureFlag};
2222
use gpui::{
2323
Action, AnyElement, App, Context, Corner, Decorations, Element, Entity, InteractiveElement,
2424
Interactivity, IntoElement, MouseButton, ParentElement, Render, Stateful,
@@ -663,7 +663,7 @@ impl TitleBar {
663663
.anchor(Corner::TopRight)
664664
.menu(move |window, cx| {
665665
ContextMenu::build(window, cx, |menu, _, cx| {
666-
menu.when(cx.has_flag::<ZedPro>(), |menu| {
666+
menu.when(cx.has_flag::<ZedProFeatureFlag>(), |menu| {
667667
menu.action(
668668
format!(
669669
"Current Plan: {}",

crates/zed/src/zed.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use command_palette_hooks::CommandPaletteFilter;
2020
use debugger_ui::debugger_panel::DebugPanel;
2121
use editor::ProposedChangesEditorToolbar;
2222
use editor::{Editor, MultiBuffer, scroll::Autoscroll};
23-
use feature_flags::{Debugger, FeatureFlagAppExt, FeatureFlagViewExt};
23+
use feature_flags::{DebuggerFeatureFlag, FeatureFlagAppExt, FeatureFlagViewExt};
2424
use futures::{StreamExt, channel::mpsc, select_biased};
2525
use git_ui::git_panel::GitPanel;
2626
use git_ui::project_diff::ProjectDiffToolbar;
@@ -279,7 +279,7 @@ fn feature_gate_zed_pro_actions(cx: &mut App) {
279279
filter.hide_action_types(&zed_pro_actions);
280280
});
281281

282-
cx.observe_flag::<feature_flags::ZedPro, _>({
282+
cx.observe_flag::<feature_flags::ZedProFeatureFlag, _>({
283283
move |is_enabled, cx| {
284284
CommandPaletteFilter::update_global(cx, |filter, _cx| {
285285
if is_enabled {
@@ -439,7 +439,7 @@ fn initialize_panels(
439439
workspace.add_panel(channels_panel, window, cx);
440440
workspace.add_panel(chat_panel, window, cx);
441441
workspace.add_panel(notification_panel, window, cx);
442-
cx.when_flag_enabled::<Debugger>(window, |_, window, cx| {
442+
cx.when_flag_enabled::<DebuggerFeatureFlag>(window, |_, window, cx| {
443443
cx.spawn_in(
444444
window,
445445
async move |workspace: gpui::WeakEntity<Workspace>,

0 commit comments

Comments
 (0)