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.

Remove 'Destructive' prompts (#11631)

Conrad Irwin0c2d71f1ace6
diff --git a/crates/file_finder/src/new_path_prompt.rs b/crates/file_finder/src/new_path_prompt.rs
index e538576b98c..d2607920982 100644
--- a/crates/file_finder/src/new_path_prompt.rs
+++ b/crates/file_finder/src/new_path_prompt.rs
@@ -334,7 +334,7 @@ impl PickerDelegate for NewPathDelegate {
if exists {
self.should_dismiss = false;
let answer = cx.prompt(
- gpui::PromptLevel::Destructive,
+ gpui::PromptLevel::Critical,
&format!("{} already exists. Do you want to replace it?", m.relative_path()),
Some(
"A file or folder with the same name already eixsts. Replacing it will overwrite its current contents.",
diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs
index 26e1868ff39..083c6d5fe11 100644
--- a/crates/gpui/src/platform.rs
+++ b/crates/gpui/src/platform.rs
@@ -719,10 +719,6 @@ pub enum PromptLevel {
/// A prompt that is shown when a critical problem has occurred
Critical,
-
- /// A prompt that is shown when asking the user to confirm a potentially destructive action
- /// (overwriting a file for example)
- Destructive,
}
/// The style of the cursor (pointer)
diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs
index 09f5f3241ab..eab3eddd254 100644
--- a/crates/gpui/src/platform/mac/window.rs
+++ b/crates/gpui/src/platform/mac/window.rs
@@ -890,7 +890,7 @@ impl PlatformWindow for MacWindow {
let alert_style = match level {
PromptLevel::Info => 1,
PromptLevel::Warning => 0,
- PromptLevel::Critical | PromptLevel::Destructive => 2,
+ PromptLevel::Critical => 2,
};
let _: () = msg_send![alert, setAlertStyle: alert_style];
let _: () = msg_send![alert, setMessageText: ns_string(msg)];
@@ -905,16 +905,10 @@ impl PlatformWindow for MacWindow {
{
let button: id = msg_send![alert, addButtonWithTitle: ns_string(answer)];
let _: () = msg_send![button, setTag: ix as NSInteger];
- if level == PromptLevel::Destructive && answer != &"Cancel" {
- let _: () = msg_send![button, setHasDestructiveAction: YES];
- }
}
if let Some((ix, answer)) = latest_non_cancel_label {
let button: id = msg_send![alert, addButtonWithTitle: ns_string(answer)];
let _: () = msg_send![button, setTag: ix as NSInteger];
- if level == PromptLevel::Destructive {
- let _: () = msg_send![button, setHasDestructiveAction: YES];
- }
}
let (done_tx, done_rx) = oneshot::channel();
diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rs
index 55ecd0829c6..91e6af0fb5a 100644
--- a/crates/gpui/src/platform/windows/window.rs
+++ b/crates/gpui/src/platform/windows/window.rs
@@ -437,7 +437,7 @@ impl PlatformWindow for WindowsWindow {
title = windows::core::w!("Warning");
main_icon = TD_WARNING_ICON;
}
- crate::PromptLevel::Critical | crate::PromptLevel::Destructive => {
+ crate::PromptLevel::Critical => {
title = windows::core::w!("Critical");
main_icon = TD_ERROR_ICON;
}
diff --git a/crates/workspace/src/notifications.rs b/crates/workspace/src/notifications.rs
index 2757b6e5612..c7ea762e154 100644
--- a/crates/workspace/src/notifications.rs
+++ b/crates/workspace/src/notifications.rs
@@ -263,7 +263,7 @@ impl Render for LanguageServerPrompt {
PromptLevel::Warning => {
Some(DiagnosticSeverity::WARNING)
}
- PromptLevel::Critical | PromptLevel::Destructive => {
+ PromptLevel::Critical => {
Some(DiagnosticSeverity::ERROR)
}
}