Compare commits

...
Sign in to create a new pull request.

2 commits

2 changed files with 27 additions and 16 deletions

View file

@ -300,6 +300,10 @@ impl ActiveView {
MessageEditorEvent::Changed | MessageEditorEvent::EstimatedTokenCount => { MessageEditorEvent::Changed | MessageEditorEvent::EstimatedTokenCount => {
cx.notify(); cx.notify();
} }
MessageEditorEvent::DismissOnboarding => {
OnboardingUpsell::set_dismissed(true, cx);
cx.notify();
}
MessageEditorEvent::ScrollThreadToBottom => match &this.active_view { MessageEditorEvent::ScrollThreadToBottom => match &this.active_view {
ActiveView::Thread { thread, .. } => { ActiveView::Thread { thread, .. } => {
thread.update(cx, |thread, cx| { thread.update(cx, |thread, cx| {
@ -655,21 +659,6 @@ impl AgentPanel {
) )
}); });
let message_editor = cx.new(|cx| {
MessageEditor::new(
fs.clone(),
workspace.clone(),
message_editor_context_store.clone(),
prompt_store.clone(),
thread_store.downgrade(),
context_store.downgrade(),
Some(history_store.downgrade()),
thread.clone(),
window,
cx,
)
});
let acp_history_store = cx.new(|cx| agent2::HistoryStore::new(context_store.clone(), cx)); let acp_history_store = cx.new(|cx| agent2::HistoryStore::new(context_store.clone(), cx));
let acp_history = cx.new(|cx| AcpThreadHistory::new(acp_history_store.clone(), window, cx)); let acp_history = cx.new(|cx| AcpThreadHistory::new(acp_history_store.clone(), window, cx));
cx.subscribe_in( cx.subscribe_in(
@ -710,7 +699,24 @@ impl AgentPanel {
let panel_type = AgentSettings::get_global(cx).default_view; let panel_type = AgentSettings::get_global(cx).default_view;
let active_view = match panel_type { let active_view = match panel_type {
DefaultView::Thread => ActiveView::thread(active_thread, message_editor, window, cx), DefaultView::Thread => {
let message_editor = cx.new(|cx| {
MessageEditor::new(
fs.clone(),
workspace.clone(),
message_editor_context_store.clone(),
prompt_store.clone(),
thread_store.downgrade(),
context_store.downgrade(),
Some(history_store.downgrade()),
thread.clone(),
window,
cx,
)
});
ActiveView::thread(active_thread, message_editor, window, cx)
}
DefaultView::TextThread => { DefaultView::TextThread => {
let context = let context =
context_store.update(cx, |context_store, cx| context_store.create(cx)); context_store.update(cx, |context_store, cx| context_store.create(cx));
@ -1857,6 +1863,8 @@ impl AgentPanel {
window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) { ) {
OnboardingUpsell::set_dismissed(true, cx);
match agent { match agent {
AgentType::Zed => { AgentType::Zed => {
window.dispatch_action( window.dispatch_action(

View file

@ -217,6 +217,7 @@ impl MessageEditor {
cx.subscribe_in(&context_strip, window, Self::handle_context_strip_event), cx.subscribe_in(&context_strip, window, Self::handle_context_strip_event),
cx.subscribe(&editor, |this, _, event: &EditorEvent, cx| { cx.subscribe(&editor, |this, _, event: &EditorEvent, cx| {
if event == &EditorEvent::BufferEdited { if event == &EditorEvent::BufferEdited {
cx.emit(MessageEditorEvent::DismissOnboarding);
this.handle_message_changed(cx) this.handle_message_changed(cx)
} }
}), }),
@ -1416,6 +1417,7 @@ impl MessageEditor {
} }
fn message_or_context_changed(&mut self, debounce: bool, cx: &mut Context<Self>) { fn message_or_context_changed(&mut self, debounce: bool, cx: &mut Context<Self>) {
// todo! Might want to use this instead of dismiss onboarding event
cx.emit(MessageEditorEvent::Changed); cx.emit(MessageEditorEvent::Changed);
self.update_token_count_task.take(); self.update_token_count_task.take();
@ -1639,6 +1641,7 @@ pub enum MessageEditorEvent {
EstimatedTokenCount, EstimatedTokenCount,
Changed, Changed,
ScrollThreadToBottom, ScrollThreadToBottom,
DismissOnboarding,
} }
impl Focusable for MessageEditor { impl Focusable for MessageEditor {