agent: Rename PromptEditor
to TextThread
in the panel's ActiveView
(#31705)
Was touching this part of the Agent Panel and thought it could be a quick name consistency win here, so it is aligned with the terminology we're currently actively using in the product/docs. Release Notes: - N/A
This commit is contained in:
parent
c57e6bc784
commit
fe57eedb44
1 changed files with 14 additions and 14 deletions
|
@ -174,7 +174,7 @@ enum ActiveView {
|
||||||
thread: WeakEntity<Thread>,
|
thread: WeakEntity<Thread>,
|
||||||
_subscriptions: Vec<gpui::Subscription>,
|
_subscriptions: Vec<gpui::Subscription>,
|
||||||
},
|
},
|
||||||
PromptEditor {
|
TextThread {
|
||||||
context_editor: Entity<ContextEditor>,
|
context_editor: Entity<ContextEditor>,
|
||||||
title_editor: Entity<Editor>,
|
title_editor: Entity<Editor>,
|
||||||
buffer_search_bar: Entity<BufferSearchBar>,
|
buffer_search_bar: Entity<BufferSearchBar>,
|
||||||
|
@ -194,7 +194,7 @@ impl ActiveView {
|
||||||
pub fn which_font_size_used(&self) -> WhichFontSize {
|
pub fn which_font_size_used(&self) -> WhichFontSize {
|
||||||
match self {
|
match self {
|
||||||
ActiveView::Thread { .. } | ActiveView::History => WhichFontSize::AgentFont,
|
ActiveView::Thread { .. } | ActiveView::History => WhichFontSize::AgentFont,
|
||||||
ActiveView::PromptEditor { .. } => WhichFontSize::BufferFont,
|
ActiveView::TextThread { .. } => WhichFontSize::BufferFont,
|
||||||
ActiveView::Configuration => WhichFontSize::None,
|
ActiveView::Configuration => WhichFontSize::None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@ impl ActiveView {
|
||||||
buffer_search_bar.set_active_pane_item(Some(&context_editor), window, cx)
|
buffer_search_bar.set_active_pane_item(Some(&context_editor), window, cx)
|
||||||
});
|
});
|
||||||
|
|
||||||
Self::PromptEditor {
|
Self::TextThread {
|
||||||
context_editor,
|
context_editor,
|
||||||
title_editor: editor,
|
title_editor: editor,
|
||||||
buffer_search_bar,
|
buffer_search_bar,
|
||||||
|
@ -1324,7 +1324,7 @@ impl AgentPanel {
|
||||||
|
|
||||||
pub(crate) fn active_context_editor(&self) -> Option<Entity<ContextEditor>> {
|
pub(crate) fn active_context_editor(&self) -> Option<Entity<ContextEditor>> {
|
||||||
match &self.active_view {
|
match &self.active_view {
|
||||||
ActiveView::PromptEditor { context_editor, .. } => Some(context_editor.clone()),
|
ActiveView::TextThread { context_editor, .. } => Some(context_editor.clone()),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1358,7 +1358,7 @@ impl AgentPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ActiveView::PromptEditor { context_editor, .. } => {
|
ActiveView::TextThread { context_editor, .. } => {
|
||||||
let context = context_editor.read(cx).context();
|
let context = context_editor.read(cx).context();
|
||||||
// When switching away from an unsaved text thread, delete its entry.
|
// When switching away from an unsaved text thread, delete its entry.
|
||||||
if context.read(cx).path().is_none() {
|
if context.read(cx).path().is_none() {
|
||||||
|
@ -1378,7 +1378,7 @@ impl AgentPanel {
|
||||||
store.push_recently_opened_entry(RecentEntry::Thread(id, thread), cx);
|
store.push_recently_opened_entry(RecentEntry::Thread(id, thread), cx);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
ActiveView::PromptEditor { context_editor, .. } => {
|
ActiveView::TextThread { context_editor, .. } => {
|
||||||
self.history_store.update(cx, |store, cx| {
|
self.history_store.update(cx, |store, cx| {
|
||||||
let context = context_editor.read(cx).context().clone();
|
let context = context_editor.read(cx).context().clone();
|
||||||
store.push_recently_opened_entry(RecentEntry::Context(context), cx)
|
store.push_recently_opened_entry(RecentEntry::Context(context), cx)
|
||||||
|
@ -1407,7 +1407,7 @@ impl Focusable for AgentPanel {
|
||||||
match &self.active_view {
|
match &self.active_view {
|
||||||
ActiveView::Thread { .. } => self.message_editor.focus_handle(cx),
|
ActiveView::Thread { .. } => self.message_editor.focus_handle(cx),
|
||||||
ActiveView::History => self.history.focus_handle(cx),
|
ActiveView::History => self.history.focus_handle(cx),
|
||||||
ActiveView::PromptEditor { context_editor, .. } => context_editor.focus_handle(cx),
|
ActiveView::TextThread { context_editor, .. } => context_editor.focus_handle(cx),
|
||||||
ActiveView::Configuration => {
|
ActiveView::Configuration => {
|
||||||
if let Some(configuration) = self.configuration.as_ref() {
|
if let Some(configuration) = self.configuration.as_ref() {
|
||||||
configuration.focus_handle(cx)
|
configuration.focus_handle(cx)
|
||||||
|
@ -1559,7 +1559,7 @@ impl AgentPanel {
|
||||||
.into_any_element(),
|
.into_any_element(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ActiveView::PromptEditor {
|
ActiveView::TextThread {
|
||||||
title_editor,
|
title_editor,
|
||||||
context_editor,
|
context_editor,
|
||||||
..
|
..
|
||||||
|
@ -1651,7 +1651,7 @@ impl AgentPanel {
|
||||||
|
|
||||||
let show_token_count = match &self.active_view {
|
let show_token_count = match &self.active_view {
|
||||||
ActiveView::Thread { .. } => !is_empty || !editor_empty,
|
ActiveView::Thread { .. } => !is_empty || !editor_empty,
|
||||||
ActiveView::PromptEditor { .. } => true,
|
ActiveView::TextThread { .. } => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1967,7 +1967,7 @@ impl AgentPanel {
|
||||||
|
|
||||||
Some(token_count)
|
Some(token_count)
|
||||||
}
|
}
|
||||||
ActiveView::PromptEditor { context_editor, .. } => {
|
ActiveView::TextThread { context_editor, .. } => {
|
||||||
let element = render_remaining_tokens(context_editor, cx)?;
|
let element = render_remaining_tokens(context_editor, cx)?;
|
||||||
|
|
||||||
Some(element.into_any_element())
|
Some(element.into_any_element())
|
||||||
|
@ -2885,7 +2885,7 @@ impl AgentPanel {
|
||||||
) -> Div {
|
) -> Div {
|
||||||
let mut registrar = buffer_search::DivRegistrar::new(
|
let mut registrar = buffer_search::DivRegistrar::new(
|
||||||
|this, _, _cx| match &this.active_view {
|
|this, _, _cx| match &this.active_view {
|
||||||
ActiveView::PromptEditor {
|
ActiveView::TextThread {
|
||||||
buffer_search_bar, ..
|
buffer_search_bar, ..
|
||||||
} => Some(buffer_search_bar.clone()),
|
} => Some(buffer_search_bar.clone()),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
@ -3003,7 +3003,7 @@ impl AgentPanel {
|
||||||
.detach();
|
.detach();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ActiveView::PromptEditor { context_editor, .. } => {
|
ActiveView::TextThread { context_editor, .. } => {
|
||||||
context_editor.update(cx, |context_editor, cx| {
|
context_editor.update(cx, |context_editor, cx| {
|
||||||
ContextEditor::insert_dragged_files(
|
ContextEditor::insert_dragged_files(
|
||||||
context_editor,
|
context_editor,
|
||||||
|
@ -3030,7 +3030,7 @@ impl AgentPanel {
|
||||||
fn key_context(&self) -> KeyContext {
|
fn key_context(&self) -> KeyContext {
|
||||||
let mut key_context = KeyContext::new_with_defaults();
|
let mut key_context = KeyContext::new_with_defaults();
|
||||||
key_context.add("AgentPanel");
|
key_context.add("AgentPanel");
|
||||||
if matches!(self.active_view, ActiveView::PromptEditor { .. }) {
|
if matches!(self.active_view, ActiveView::TextThread { .. }) {
|
||||||
key_context.add("prompt_editor");
|
key_context.add("prompt_editor");
|
||||||
}
|
}
|
||||||
key_context
|
key_context
|
||||||
|
@ -3096,7 +3096,7 @@ impl Render for AgentPanel {
|
||||||
.children(self.render_last_error(cx))
|
.children(self.render_last_error(cx))
|
||||||
.child(self.render_drag_target(cx)),
|
.child(self.render_drag_target(cx)),
|
||||||
ActiveView::History => parent.child(self.history.clone()),
|
ActiveView::History => parent.child(self.history.clone()),
|
||||||
ActiveView::PromptEditor {
|
ActiveView::TextThread {
|
||||||
context_editor,
|
context_editor,
|
||||||
buffer_search_bar,
|
buffer_search_bar,
|
||||||
..
|
..
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue