Detailed changes
@@ -739,10 +739,13 @@ impl ThreadView {
}
}
}));
+ if self.parent_id.is_none() {
+ self.suppress_merge_conflict_notification(cx);
+ }
generation
}
- pub fn stop_turn(&mut self, generation: usize) {
+ pub fn stop_turn(&mut self, generation: usize, cx: &mut Context<Self>) {
if self.turn_fields.turn_generation != generation {
return;
}
@@ -753,6 +756,25 @@ impl ThreadView {
.map(|started| started.elapsed());
self.turn_fields.last_turn_tokens = self.turn_fields.turn_tokens.take();
self.turn_fields._turn_timer_task = None;
+ if self.parent_id.is_none() {
+ self.unsuppress_merge_conflict_notification(cx);
+ }
+ }
+
+ fn suppress_merge_conflict_notification(&self, cx: &mut Context<Self>) {
+ self.workspace
+ .update(cx, |workspace, cx| {
+ workspace.suppress_notification(&workspace::merge_conflict_notification_id(), cx);
+ })
+ .ok();
+ }
+
+ fn unsuppress_merge_conflict_notification(&self, cx: &mut Context<Self>) {
+ self.workspace
+ .update(cx, |workspace, _cx| {
+ workspace.unsuppress(workspace::merge_conflict_notification_id());
+ })
+ .ok();
}
pub fn update_turn_tokens(&mut self, cx: &App) {
@@ -962,7 +984,7 @@ impl ThreadView {
let mut cx = cx.clone();
move || {
this.update(&mut cx, |this, cx| {
- this.stop_turn(generation);
+ this.stop_turn(generation, cx);
cx.notify();
})
.ok();
@@ -18,10 +18,7 @@ use settings::Settings;
use std::{cell::RefCell, ops::Range, rc::Rc, sync::Arc};
use ui::{ActiveTheme, Divider, Element as _, Styled, Window, prelude::*};
use util::{ResultExt as _, debug_panic, maybe};
-use workspace::{
- Workspace,
- notifications::{NotificationId, simple_message_notification::MessageNotification},
-};
+use workspace::{Workspace, notifications::simple_message_notification::MessageNotification};
use zed_actions::agent::{
ConflictContent, ResolveConflictedFilesWithAgent, ResolveConflictsWithAgent,
};
@@ -500,12 +497,6 @@ fn render_conflict_buttons(
.into_any()
}
-struct MergeConflictNotification;
-
-fn merge_conflict_notification_id() -> NotificationId {
- NotificationId::unique::<MergeConflictNotification>()
-}
-
fn collect_conflicted_file_paths(workspace: &Workspace, cx: &App) -> Vec<String> {
let project = workspace.project().read(cx);
let git_store = project.git_store().read(cx);
@@ -547,8 +538,12 @@ pub(crate) fn register_conflict_notification(
return;
}
+ if workspace.is_notification_suppressed(workspace::merge_conflict_notification_id()) {
+ return;
+ }
+
let paths = collect_conflicted_file_paths(workspace, cx);
- let notification_id = merge_conflict_notification_id();
+ let notification_id = workspace::merge_conflict_notification_id();
let current_paths_set: HashSet<String> = paths.iter().cloned().collect();
if paths.is_empty() {
@@ -234,6 +234,14 @@ impl Workspace {
self.suppressed_notifications.insert(id.clone());
}
+ pub fn is_notification_suppressed(&self, notification_id: NotificationId) -> bool {
+ self.suppressed_notifications.contains(¬ification_id)
+ }
+
+ pub fn unsuppress(&mut self, notification_id: NotificationId) {
+ self.suppressed_notifications.remove(¬ification_id);
+ }
+
pub fn show_initial_notifications(&mut self, cx: &mut Context<Self>) {
// Allow absence of the global so that tests don't need to initialize it.
let app_notifications = GLOBAL_APP_NOTIFICATIONS
@@ -7268,6 +7268,12 @@ impl GlobalAnyActiveCall {
cx.global()
}
}
+
+pub fn merge_conflict_notification_id() -> NotificationId {
+ struct MergeConflictNotification;
+ NotificationId::unique::<MergeConflictNotification>()
+}
+
/// Workspace-local view of a remote participant's location.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ParticipantLocation {