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.

Add TestPanic feature flag (#34963)

Julia Ryan5f0edd38f896
diff --git a/Cargo.lock b/Cargo.lock
index 8be4c9d7be7..6ded3ce5eb0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -20211,6 +20211,7 @@ dependencies = [
"extension",
"extension_host",
"extensions_ui",
+ "feature_flags",
"feedback",
"file_finder",
"fs",
diff --git a/crates/feature_flags/src/feature_flags.rs b/crates/feature_flags/src/feature_flags.rs
index da85133bb9b..631bafc8413 100644
--- a/crates/feature_flags/src/feature_flags.rs
+++ b/crates/feature_flags/src/feature_flags.rs
@@ -85,6 +85,11 @@ impl FeatureFlag for ThreadAutoCaptureFeatureFlag {
false
}
}
+pub struct PanicFeatureFlag;
+
+impl FeatureFlag for PanicFeatureFlag {
+ const NAME: &'static str = "panic";
+}
pub struct JjUiFeatureFlag {}
diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml
index e565aba26b4..1b564941458 100644
--- a/crates/zed/Cargo.toml
+++ b/crates/zed/Cargo.toml
@@ -56,6 +56,7 @@ env_logger.workspace = true
extension.workspace = true
extension_host.workspace = true
extensions_ui.workspace = true
+feature_flags.workspace = true
feedback.workspace = true
file_finder.workspace = true
fs.workspace = true
diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs
index 24c7ab5ba27..57534c8cd54 100644
--- a/crates/zed/src/zed.rs
+++ b/crates/zed/src/zed.rs
@@ -19,6 +19,7 @@ use collections::VecDeque;
use debugger_ui::debugger_panel::DebugPanel;
use editor::ProposedChangesEditorToolbar;
use editor::{Editor, MultiBuffer};
+use feature_flags::{FeatureFlagAppExt, PanicFeatureFlag};
use futures::future::Either;
use futures::{StreamExt, channel::mpsc, select_biased};
use git_ui::git_panel::GitPanel;
@@ -53,9 +54,12 @@ use settings::{
initial_local_debug_tasks_content, initial_project_settings_content, initial_tasks_content,
update_settings_file,
};
-use std::path::PathBuf;
-use std::sync::atomic::{self, AtomicBool};
-use std::{borrow::Cow, path::Path, sync::Arc};
+use std::{
+ borrow::Cow,
+ path::{Path, PathBuf},
+ sync::Arc,
+ sync::atomic::{self, AtomicBool},
+};
use terminal_view::terminal_panel::{self, TerminalPanel};
use theme::{ActiveTheme, ThemeSettings};
use ui::{PopoverMenuHandle, prelude::*};
@@ -120,11 +124,9 @@ pub fn init(cx: &mut App) {
cx.on_action(quit);
cx.on_action(|_: &RestoreBanner, cx| title_bar::restore_banner(cx));
-
- if ReleaseChannel::global(cx) == ReleaseChannel::Dev {
- cx.on_action(test_panic);
+ if ReleaseChannel::global(cx) == ReleaseChannel::Dev || cx.has_flag::<PanicFeatureFlag>() {
+ cx.on_action(|_: &TestPanic, _| panic!("Ran the TestPanic action"));
}
-
cx.on_action(|_: &OpenLog, cx| {
with_active_or_new_workspace(cx, |workspace, window, cx| {
open_log_file(workspace, window, cx);
@@ -987,10 +989,6 @@ fn about(
.detach();
}
-fn test_panic(_: &TestPanic, _: &mut App) {
- panic!("Ran the TestPanic action")
-}
-
fn install_cli(
_: &mut Workspace,
_: &install_cli::Install,