Rename conversations to contexts (#12724)

Antonio Scandurra created

This just changes nomenclature within the codebase and should have no
external effect.

Release Notes:

- N/A

Change summary

assets/keymaps/default-linux.json        |   2 
assets/keymaps/default-macos.json        |   2 
crates/assistant/src/assistant.rs        |   4 
crates/assistant/src/assistant_panel.rs  | 409 +++++++++++--------------
crates/assistant/src/context_store.rs    |  85 ++--
crates/assistant/src/inline_assistant.rs |  14 
crates/assistant/src/slash_command.rs    |   6 
crates/util/src/paths.rs                 |   2 
8 files changed, 242 insertions(+), 282 deletions(-)

Detailed changes

assets/keymaps/default-linux.json 🔗

@@ -545,7 +545,7 @@
     }
   },
   {
-    "context": "ConversationEditor > Editor",
+    "context": "ContextEditor > Editor",
     "bindings": {
       "ctrl-enter": "assistant::Assist",
       "ctrl-s": "workspace::Save",

assets/keymaps/default-macos.json 🔗

@@ -228,7 +228,7 @@
     }
   },
   {
-    "context": "ConversationEditor > Editor",
+    "context": "ContextEditor > Editor",
     "bindings": {
       "cmd-enter": "assistant::Assist",
       "cmd-s": "workspace::Save",

crates/assistant/src/assistant.rs 🔗

@@ -1,7 +1,7 @@
 pub mod assistant_panel;
 pub mod assistant_settings;
 mod completion_provider;
-mod conversation_store;
+mod context_store;
 mod inline_assistant;
 mod model_selector;
 mod prompt_library;
@@ -17,7 +17,7 @@ use assistant_slash_command::SlashCommandRegistry;
 use client::{proto, Client};
 use command_palette_hooks::CommandPaletteFilter;
 pub(crate) use completion_provider::*;
-pub(crate) use conversation_store::*;
+pub(crate) use context_store::*;
 use gpui::{actions, AppContext, Global, SharedString, UpdateGlobal};
 pub(crate) use inline_assistant::*;
 pub(crate) use model_selector::*;

crates/assistant/src/assistant_panel.rs 🔗

@@ -6,11 +6,10 @@ use crate::{
         default_command::DefaultSlashCommand, SlashCommandCompletionProvider, SlashCommandLine,
         SlashCommandRegistry,
     },
-    ApplyEdit, Assist, CompletionProvider, ConfirmCommand, ConversationStore, CycleMessageRole,
+    ApplyEdit, Assist, CompletionProvider, ConfirmCommand, ContextStore, CycleMessageRole,
     InlineAssist, InlineAssistant, LanguageModelRequest, LanguageModelRequestMessage, MessageId,
-    MessageMetadata, MessageStatus, ModelSelector, QuoteSelection, ResetKey, Role,
-    SavedConversation, SavedConversationMetadata, SavedMessage, Split, ToggleFocus, ToggleHistory,
-    ToggleModelSelector,
+    MessageMetadata, MessageStatus, ModelSelector, QuoteSelection, ResetKey, Role, SavedContext,
+    SavedContextMetadata, SavedMessage, Split, ToggleFocus, ToggleHistory, ToggleModelSelector,
 };
 use anyhow::{anyhow, Result};
 use assistant_slash_command::{SlashCommand, SlashCommandOutput, SlashCommandOutputSection};
@@ -30,10 +29,10 @@ use futures::future::Shared;
 use futures::{FutureExt, StreamExt};
 use gpui::{
     div, point, rems, Action, AnyElement, AnyView, AppContext, AsyncAppContext, AsyncWindowContext,
-    ClipboardItem, Context, Empty, EventEmitter, FocusHandle, FocusableView, InteractiveElement,
-    IntoElement, Model, ModelContext, ParentElement, Pixels, Render, SharedString,
-    StatefulInteractiveElement, Styled, Subscription, Task, UpdateGlobal, View, ViewContext,
-    VisualContext, WeakView, WindowContext,
+    ClipboardItem, Context as _, Empty, EventEmitter, FocusHandle, FocusableView,
+    InteractiveElement, IntoElement, Model, ModelContext, ParentElement, Pixels, Render,
+    SharedString, StatefulInteractiveElement, Styled, Subscription, Task, UpdateGlobal, View,
+    ViewContext, VisualContext, WeakView, WindowContext,
 };
 use language::{
     language_settings::SoftWrap, AnchorRangeExt, AutoindentMode, Buffer, LanguageRegistry,
@@ -58,7 +57,7 @@ use ui::{
     popover_menu, prelude::*, ButtonLike, ContextMenu, ElevationIndex, KeyBinding, ListItem,
     ListItemSpacing, PopoverMenuHandle, Tab, TabBar, Tooltip,
 };
-use util::{paths::CONVERSATIONS_DIR, post_inc, ResultExt, TryFutureExt};
+use util::{paths::CONTEXTS_DIR, post_inc, ResultExt, TryFutureExt};
 use uuid::Uuid;
 use workspace::NewFile;
 use workspace::{
@@ -81,8 +80,7 @@ pub fn init(cx: &mut AppContext) {
                 })
                 .register_action(AssistantPanel::inline_assist)
                 .register_action(AssistantPanel::cancel_last_inline_assist)
-                // .register_action(ConversationEditor::insert_active_prompt)
-                .register_action(ConversationEditor::quote_selection);
+                .register_action(ContextEditor::quote_selection);
         },
     )
     .detach();
@@ -92,10 +90,10 @@ pub struct AssistantPanel {
     workspace: WeakView<Workspace>,
     width: Option<Pixels>,
     height: Option<Pixels>,
-    active_conversation_editor: Option<ActiveConversationEditor>,
-    show_saved_conversations: bool,
-    conversation_store: Model<ConversationStore>,
-    saved_conversation_picker: View<Picker<SavedConversationPickerDelegate>>,
+    active_context_editor: Option<ActiveContextEditor>,
+    show_saved_contexts: bool,
+    context_store: Model<ContextStore>,
+    saved_context_picker: View<Picker<SavedContextPickerDelegate>>,
     zoomed: bool,
     focus_handle: FocusHandle,
     toolbar: View<Toolbar>,
@@ -108,20 +106,20 @@ pub struct AssistantPanel {
     model_menu_handle: PopoverMenuHandle<ContextMenu>,
 }
 
-struct SavedConversationPickerDelegate {
-    store: Model<ConversationStore>,
-    matches: Vec<SavedConversationMetadata>,
+struct SavedContextPickerDelegate {
+    store: Model<ContextStore>,
+    matches: Vec<SavedContextMetadata>,
     selected_index: usize,
 }
 
-enum SavedConversationPickerEvent {
+enum SavedContextPickerEvent {
     Confirmed { path: PathBuf },
 }
 
-impl EventEmitter<SavedConversationPickerEvent> for Picker<SavedConversationPickerDelegate> {}
+impl EventEmitter<SavedContextPickerEvent> for Picker<SavedContextPickerDelegate> {}
 
-impl SavedConversationPickerDelegate {
-    fn new(store: Model<ConversationStore>) -> Self {
+impl SavedContextPickerDelegate {
+    fn new(store: Model<ContextStore>) -> Self {
         Self {
             store,
             matches: Vec::new(),
@@ -130,7 +128,7 @@ impl SavedConversationPickerDelegate {
     }
 }
 
-impl PickerDelegate for SavedConversationPickerDelegate {
+impl PickerDelegate for SavedContextPickerDelegate {
     type ListItem = ListItem;
 
     fn match_count(&self) -> usize {
@@ -164,7 +162,7 @@ impl PickerDelegate for SavedConversationPickerDelegate {
 
     fn confirm(&mut self, _secondary: bool, cx: &mut ViewContext<Picker<Self>>) {
         if let Some(metadata) = self.matches.get(self.selected_index) {
-            cx.emit(SavedConversationPickerEvent::Confirmed {
+            cx.emit(SavedContextPickerEvent::Confirmed {
                 path: metadata.path.clone(),
             })
         }
@@ -178,7 +176,7 @@ impl PickerDelegate for SavedConversationPickerDelegate {
         selected: bool,
         _cx: &mut ViewContext<Picker<Self>>,
     ) -> Option<Self::ListItem> {
-        let conversation = self.matches.get(ix)?;
+        let context = self.matches.get(ix)?;
         Some(
             ListItem::new(ix)
                 .inset(true)
@@ -190,18 +188,18 @@ impl PickerDelegate for SavedConversationPickerDelegate {
                         .w_full()
                         .gap_2()
                         .child(
-                            Label::new(conversation.mtime.format("%F %I:%M%p").to_string())
+                            Label::new(context.mtime.format("%F %I:%M%p").to_string())
                                 .color(Color::Muted)
                                 .size(LabelSize::Small),
                         )
-                        .child(Label::new(conversation.title.clone()).size(LabelSize::Small)),
+                        .child(Label::new(context.title.clone()).size(LabelSize::Small)),
                 ),
         )
     }
 }
 
-struct ActiveConversationEditor {
-    editor: View<ConversationEditor>,
+struct ActiveContextEditor {
+    editor: View<ContextEditor>,
     _subscriptions: Vec<Subscription>,
 }
 
@@ -212,9 +210,7 @@ impl AssistantPanel {
     ) -> Task<Result<View<Self>>> {
         cx.spawn(|mut cx| async move {
             let fs = workspace.update(&mut cx, |workspace, _| workspace.app_state().fs.clone())?;
-            let conversation_store = cx
-                .update(|cx| ConversationStore::new(fs.clone(), cx))?
-                .await?;
+            let context_store = cx.update(|cx| ContextStore::new(fs.clone(), cx))?.await?;
 
             // TODO: deserialize state.
             let workspace_handle = workspace.clone();
@@ -227,9 +223,9 @@ impl AssistantPanel {
                         toolbar
                     });
 
-                    let saved_conversation_picker = cx.new_view(|cx| {
+                    let saved_context_picker = cx.new_view(|cx| {
                         Picker::uniform_list(
-                            SavedConversationPickerDelegate::new(conversation_store.clone()),
+                            SavedContextPickerDelegate::new(context_store.clone()),
                             cx,
                         )
                         .modal(false)
@@ -249,13 +245,13 @@ impl AssistantPanel {
                                     CompletionProvider::global(cx).settings_version();
                             }
                         }),
-                        cx.observe(&conversation_store, |this, _, cx| {
-                            this.saved_conversation_picker
+                        cx.observe(&context_store, |this, _, cx| {
+                            this.saved_context_picker
                                 .update(cx, |picker, cx| picker.refresh(cx));
                         }),
                         cx.subscribe(
-                            &saved_conversation_picker,
-                            Self::handle_saved_conversation_picker_event,
+                            &saved_context_picker,
+                            Self::handle_saved_context_picker_event,
                         ),
                     ];
 
@@ -266,10 +262,10 @@ impl AssistantPanel {
 
                     Self {
                         workspace: workspace_handle,
-                        active_conversation_editor: None,
-                        show_saved_conversations: false,
-                        saved_conversation_picker,
-                        conversation_store,
+                        active_context_editor: None,
+                        show_saved_contexts: false,
+                        saved_context_picker,
+                        context_store,
                         zoomed: false,
                         focus_handle,
                         toolbar,
@@ -293,10 +289,10 @@ impl AssistantPanel {
             .update(cx, |toolbar, cx| toolbar.focus_changed(true, cx));
         cx.notify();
         if self.focus_handle.is_focused(cx) {
-            if self.show_saved_conversations {
-                cx.focus_view(&self.saved_conversation_picker);
-            } else if let Some(conversation) = self.active_conversation_editor() {
-                cx.focus_view(conversation);
+            if self.show_saved_contexts {
+                cx.focus_view(&self.saved_context_picker);
+            } else if let Some(context) = self.active_context_editor() {
+                cx.focus_view(context);
             }
         }
     }
@@ -315,18 +311,16 @@ impl AssistantPanel {
         if self.is_authenticated(cx) {
             self.authentication_prompt = None;
 
-            if let Some(editor) = self.active_conversation_editor() {
-                editor.update(cx, |active_conversation, cx| {
-                    active_conversation
-                        .conversation
-                        .update(cx, |conversation, cx| {
-                            conversation.completion_provider_changed(cx)
-                        })
+            if let Some(editor) = self.active_context_editor() {
+                editor.update(cx, |active_context, cx| {
+                    active_context
+                        .context
+                        .update(cx, |context, cx| context.completion_provider_changed(cx))
                 })
             }
 
-            if self.active_conversation_editor().is_none() {
-                self.new_conversation(cx);
+            if self.active_context_editor().is_none() {
+                self.new_context(cx);
             }
             cx.notify();
         } else if self.authentication_prompt.is_none()
@@ -340,16 +334,15 @@ impl AssistantPanel {
         }
     }
 
-    fn handle_saved_conversation_picker_event(
+    fn handle_saved_context_picker_event(
         &mut self,
-        _picker: View<Picker<SavedConversationPickerDelegate>>,
-        event: &SavedConversationPickerEvent,
+        _picker: View<Picker<SavedContextPickerDelegate>>,
+        event: &SavedContextPickerEvent,
         cx: &mut ViewContext<Self>,
     ) {
         match event {
-            SavedConversationPickerEvent::Confirmed { path } => {
-                self.open_conversation(path.clone(), cx)
-                    .detach_and_log_err(cx);
+            SavedContextPickerEvent::Confirmed { path } => {
+                self.open_context(path.clone(), cx).detach_and_log_err(cx);
             }
         }
     }
@@ -368,30 +361,29 @@ impl AssistantPanel {
             return;
         };
 
-        let conversation_editor =
-            assistant
-                .read(cx)
-                .active_conversation_editor()
-                .and_then(|editor| {
-                    let editor = &editor.read(cx).editor;
-                    if editor.read(cx).is_focused(cx) {
-                        Some(editor.clone())
-                    } else {
-                        None
-                    }
-                });
+        let context_editor = assistant
+            .read(cx)
+            .active_context_editor()
+            .and_then(|editor| {
+                let editor = &editor.read(cx).editor;
+                if editor.read(cx).is_focused(cx) {
+                    Some(editor.clone())
+                } else {
+                    None
+                }
+            });
 
-        let include_conversation;
+        let include_context;
         let active_editor;
-        if let Some(conversation_editor) = conversation_editor {
-            active_editor = conversation_editor;
-            include_conversation = false;
+        if let Some(context_editor) = context_editor {
+            active_editor = context_editor;
+            include_context = false;
         } else if let Some(workspace_editor) = workspace
             .active_item(cx)
             .and_then(|item| item.act_as::<Editor>(cx))
         {
             active_editor = workspace_editor;
-            include_conversation = true;
+            include_context = true;
         } else {
             return;
         };
@@ -401,7 +393,7 @@ impl AssistantPanel {
                 assistant.assist(
                     &active_editor,
                     Some(cx.view().downgrade()),
-                    include_conversation,
+                    include_context,
                     cx,
                 )
             })
@@ -414,12 +406,7 @@ impl AssistantPanel {
                 if assistant.update(&mut cx, |assistant, cx| assistant.is_authenticated(cx))? {
                     cx.update(|cx| {
                         InlineAssistant::update_global(cx, |assistant, cx| {
-                            assistant.assist(
-                                &active_editor,
-                                Some(workspace),
-                                include_conversation,
-                                cx,
-                            )
+                            assistant.assist(&active_editor, Some(workspace), include_context, cx)
                         })
                     })?
                 } else {
@@ -447,11 +434,11 @@ impl AssistantPanel {
         }
     }
 
-    fn new_conversation(&mut self, cx: &mut ViewContext<Self>) -> Option<View<ConversationEditor>> {
+    fn new_context(&mut self, cx: &mut ViewContext<Self>) -> Option<View<ContextEditor>> {
         let workspace = self.workspace.upgrade()?;
 
         let editor = cx.new_view(|cx| {
-            ConversationEditor::new(
+            ContextEditor::new(
                 self.languages.clone(),
                 self.slash_commands.clone(),
                 self.fs.clone(),
@@ -460,46 +447,41 @@ impl AssistantPanel {
             )
         });
 
-        self.show_conversation(editor.clone(), cx);
+        self.show_context(editor.clone(), cx);
         Some(editor)
     }
 
-    fn show_conversation(
-        &mut self,
-        conversation_editor: View<ConversationEditor>,
-        cx: &mut ViewContext<Self>,
-    ) {
+    fn show_context(&mut self, context_editor: View<ContextEditor>, cx: &mut ViewContext<Self>) {
         let mut subscriptions = Vec::new();
-        subscriptions
-            .push(cx.subscribe(&conversation_editor, Self::handle_conversation_editor_event));
+        subscriptions.push(cx.subscribe(&context_editor, Self::handle_context_editor_event));
 
-        let conversation = conversation_editor.read(cx).conversation.clone();
-        subscriptions.push(cx.observe(&conversation, |_, _, cx| cx.notify()));
+        let context = context_editor.read(cx).context.clone();
+        subscriptions.push(cx.observe(&context, |_, _, cx| cx.notify()));
 
-        let editor = conversation_editor.read(cx).editor.clone();
+        let editor = context_editor.read(cx).editor.clone();
         self.toolbar.update(cx, |toolbar, cx| {
             toolbar.set_active_item(Some(&editor), cx);
         });
         if self.focus_handle.contains_focused(cx) {
             cx.focus_view(&editor);
         }
-        self.active_conversation_editor = Some(ActiveConversationEditor {
-            editor: conversation_editor,
+        self.active_context_editor = Some(ActiveContextEditor {
+            editor: context_editor,
             _subscriptions: subscriptions,
         });
-        self.show_saved_conversations = false;
+        self.show_saved_contexts = false;
 
         cx.notify();
     }
 
-    fn handle_conversation_editor_event(
+    fn handle_context_editor_event(
         &mut self,
-        _: View<ConversationEditor>,
-        event: &ConversationEditorEvent,
+        _: View<ContextEditor>,
+        event: &ContextEditorEvent,
         cx: &mut ViewContext<Self>,
     ) {
         match event {
-            ConversationEditorEvent::TabContentChanged => cx.notify(),
+            ContextEditorEvent::TabContentChanged => cx.notify(),
         }
     }
 
@@ -512,7 +494,7 @@ impl AssistantPanel {
     }
 
     fn toggle_history(&mut self, _: &ToggleHistory, cx: &mut ViewContext<Self>) {
-        if self.show_saved_conversations {
+        if self.show_saved_contexts {
             self.hide_history(cx);
         } else {
             self.show_history(cx);
@@ -520,17 +502,17 @@ impl AssistantPanel {
     }
 
     fn show_history(&mut self, cx: &mut ViewContext<Self>) {
-        cx.focus_view(&self.saved_conversation_picker);
-        if !self.show_saved_conversations {
-            self.show_saved_conversations = true;
+        cx.focus_view(&self.saved_context_picker);
+        if !self.show_saved_contexts {
+            self.show_saved_contexts = true;
             cx.notify();
         }
     }
 
     fn hide_history(&mut self, cx: &mut ViewContext<Self>) {
-        if let Some(editor) = self.active_conversation_editor() {
+        if let Some(editor) = self.active_context_editor() {
             cx.focus_view(&editor);
-            self.show_saved_conversations = false;
+            self.show_saved_contexts = false;
             cx.notify();
         }
     }
@@ -590,24 +572,19 @@ impl AssistantPanel {
     }
 
     fn insert_command(&mut self, name: &str, cx: &mut ViewContext<Self>) {
-        if let Some(conversation_editor) = self.active_conversation_editor() {
-            conversation_editor.update(cx, |conversation_editor, cx| {
-                conversation_editor.insert_command(name, cx)
+        if let Some(context_editor) = self.active_context_editor() {
+            context_editor.update(cx, |context_editor, cx| {
+                context_editor.insert_command(name, cx)
             });
         }
     }
 
-    fn active_conversation_editor(&self) -> Option<&View<ConversationEditor>> {
-        Some(&self.active_conversation_editor.as_ref()?.editor)
+    fn active_context_editor(&self) -> Option<&View<ContextEditor>> {
+        Some(&self.active_context_editor.as_ref()?.editor)
     }
 
-    pub fn active_conversation(&self, cx: &AppContext) -> Option<Model<Conversation>> {
-        Some(
-            self.active_conversation_editor()?
-                .read(cx)
-                .conversation
-                .clone(),
-        )
+    pub fn active_context(&self, cx: &AppContext) -> Option<Model<Context>> {
+        Some(self.active_context_editor()?.read(cx).context.clone())
     }
 
     fn render_popover_button(&self, cx: &mut ViewContext<Self>) -> impl IntoElement {
@@ -708,30 +685,28 @@ impl AssistantPanel {
     }
 
     fn render_send_button(&self, cx: &mut ViewContext<Self>) -> Option<impl IntoElement> {
-        self.active_conversation_editor
-            .as_ref()
-            .map(|conversation| {
-                let focus_handle = conversation.editor.focus_handle(cx);
-                ButtonLike::new("send_button")
-                    .style(ButtonStyle::Filled)
-                    .layer(ElevationIndex::ModalSurface)
-                    .children(
-                        KeyBinding::for_action_in(&Assist, &focus_handle, cx)
-                            .map(|binding| binding.into_any_element()),
-                    )
-                    .child(Label::new("Send"))
-                    .on_click(cx.listener(|this, _event, cx| {
-                        if let Some(active_editor) = this.active_conversation_editor() {
-                            active_editor.update(cx, |editor, cx| editor.assist(&Assist, cx));
-                        }
-                    }))
-            })
+        self.active_context_editor.as_ref().map(|context| {
+            let focus_handle = context.editor.focus_handle(cx);
+            ButtonLike::new("send_button")
+                .style(ButtonStyle::Filled)
+                .layer(ElevationIndex::ModalSurface)
+                .children(
+                    KeyBinding::for_action_in(&Assist, &focus_handle, cx)
+                        .map(|binding| binding.into_any_element()),
+                )
+                .child(Label::new("Send"))
+                .on_click(cx.listener(|this, _event, cx| {
+                    if let Some(active_editor) = this.active_context_editor() {
+                        active_editor.update(cx, |editor, cx| editor.assist(&Assist, cx));
+                    }
+                }))
+        })
     }
 
-    fn open_conversation(&mut self, path: PathBuf, cx: &mut ViewContext<Self>) -> Task<Result<()>> {
+    fn open_context(&mut self, path: PathBuf, cx: &mut ViewContext<Self>) -> Task<Result<()>> {
         cx.focus(&self.focus_handle);
 
-        let saved_conversation = self.conversation_store.read(cx).load(path.clone(), cx);
+        let saved_context = self.context_store.read(cx).load(path.clone(), cx);
         let fs = self.fs.clone();
         let workspace = self.workspace.clone();
         let slash_commands = self.slash_commands.clone();
@@ -746,9 +721,9 @@ impl AssistantPanel {
             .flatten();
 
         cx.spawn(|this, mut cx| async move {
-            let saved_conversation = saved_conversation.await?;
-            let conversation = Conversation::deserialize(
-                saved_conversation,
+            let saved_context = saved_context.await?;
+            let context = Context::deserialize(
+                saved_context,
                 path.clone(),
                 languages,
                 slash_commands,
@@ -762,15 +737,9 @@ impl AssistantPanel {
                     .upgrade()
                     .ok_or_else(|| anyhow!("workspace dropped"))?;
                 let editor = cx.new_view(|cx| {
-                    ConversationEditor::for_conversation(
-                        conversation,
-                        fs,
-                        workspace,
-                        lsp_adapter_delegate,
-                        cx,
-                    )
+                    ContextEditor::for_context(context, fs, workspace, lsp_adapter_delegate, cx)
                 });
-                this.show_conversation(editor, cx);
+                this.show_context(editor, cx);
                 anyhow::Ok(())
             })??;
             Ok(())
@@ -788,7 +757,7 @@ impl AssistantPanel {
     fn render_signed_in(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
         let header = TabBar::new("assistant_header")
             .start_child(h_flex().gap_1().child(self.render_popover_button(cx)))
-            .children(self.active_conversation_editor().map(|editor| {
+            .children(self.active_context_editor().map(|editor| {
                 h_flex()
                     .h(rems(Tab::CONTAINER_HEIGHT_IN_REMS))
                     .flex_1()
@@ -804,8 +773,8 @@ impl AssistantPanel {
             .end_child(
                 h_flex()
                     .gap_2()
-                    .when_some(self.active_conversation_editor(), |this, editor| {
-                        let conversation = editor.read(cx).conversation.clone();
+                    .when_some(self.active_context_editor(), |this, editor| {
+                        let context = editor.read(cx).context.clone();
                         this.child(
                             h_flex()
                                 .gap_1()
@@ -813,7 +782,7 @@ impl AssistantPanel {
                                     self.model_menu_handle.clone(),
                                     self.fs.clone(),
                                 ))
-                                .children(self.render_remaining_tokens(&conversation, cx)),
+                                .children(self.render_remaining_tokens(&context, cx)),
                         )
                         .child(
                             ui::Divider::vertical()
@@ -840,7 +809,7 @@ impl AssistantPanel {
                     ),
             );
 
-        let contents = if self.active_conversation_editor().is_some() {
+        let contents = if self.active_context_editor().is_some() {
             let mut registrar = DivRegistrar::new(
                 |panel, cx| panel.toolbar.read(cx).item_of_type::<BufferSearchBar>(),
                 cx,
@@ -855,7 +824,7 @@ impl AssistantPanel {
             .key_context("AssistantPanel")
             .size_full()
             .on_action(cx.listener(|this, _: &workspace::NewFile, cx| {
-                this.new_conversation(cx);
+                this.new_context(cx);
             }))
             .on_action(cx.listener(AssistantPanel::toggle_zoom))
             .on_action(cx.listener(AssistantPanel::toggle_history))
@@ -873,12 +842,12 @@ impl AssistantPanel {
                 Some(self.toolbar.clone())
             })
             .child(contents.flex_1().child(
-                if self.show_saved_conversations || self.active_conversation_editor().is_none() {
+                if self.show_saved_contexts || self.active_context_editor().is_none() {
                     div()
                         .size_full()
-                        .child(self.saved_conversation_picker.clone())
+                        .child(self.saved_context_picker.clone())
                         .into_any_element()
-                } else if let Some(editor) = self.active_conversation_editor() {
+                } else if let Some(editor) = self.active_context_editor() {
                     let editor = editor.clone();
                     div()
                         .size_full()
@@ -901,10 +870,10 @@ impl AssistantPanel {
 
     fn render_remaining_tokens(
         &self,
-        conversation: &Model<Conversation>,
+        context: &Model<Context>,
         cx: &mut ViewContext<Self>,
     ) -> Option<impl IntoElement> {
-        let remaining_tokens = conversation.read(cx).remaining_tokens(cx)?;
+        let remaining_tokens = context.read(cx).remaining_tokens(cx)?;
         let remaining_tokens_color = if remaining_tokens <= 0 {
             Color::Error
         } else if remaining_tokens <= 500 {
@@ -991,8 +960,8 @@ impl Panel for AssistantPanel {
             cx.spawn(|this, mut cx| async move {
                 load_credentials.await?;
                 this.update(&mut cx, |this, cx| {
-                    if this.is_authenticated(cx) && this.active_conversation_editor().is_none() {
-                        this.new_conversation(cx);
+                    if this.is_authenticated(cx) && this.active_context_editor().is_none() {
+                        this.new_context(cx);
                     }
                 })
             })
@@ -1027,7 +996,7 @@ impl FocusableView for AssistantPanel {
 }
 
 #[derive(Clone)]
-enum ConversationEvent {
+enum ContextEvent {
     MessagesEdited,
     SummaryChanged,
     EditSuggestionsChanged,
@@ -1049,7 +1018,7 @@ struct Summary {
     done: bool,
 }
 
-pub struct Conversation {
+pub struct Context {
     id: Option<String>,
     buffer: Model<Buffer>,
     edit_suggestions: Vec<EditSuggestion>,
@@ -1073,9 +1042,9 @@ pub struct Conversation {
     language_registry: Arc<LanguageRegistry>,
 }
 
-impl EventEmitter<ConversationEvent> for Conversation {}
+impl EventEmitter<ContextEvent> for Context {}
 
-impl Conversation {
+impl Context {
     fn new(
         language_registry: Arc<LanguageRegistry>,
         slash_command_registry: Arc<SlashCommandRegistry>,
@@ -1131,11 +1100,11 @@ impl Conversation {
         this
     }
 
-    fn serialize(&self, cx: &AppContext) -> SavedConversation {
-        SavedConversation {
+    fn serialize(&self, cx: &AppContext) -> SavedContext {
+        SavedContext {
             id: self.id.clone(),
-            zed: "conversation".into(),
-            version: SavedConversation::VERSION.into(),
+            zed: "context".into(),
+            version: SavedContext::VERSION.into(),
             text: self.buffer.read(cx).text(),
             message_metadata: self.messages_metadata.clone(),
             messages: self
@@ -1155,14 +1124,14 @@ impl Conversation {
 
     #[allow(clippy::too_many_arguments)]
     async fn deserialize(
-        saved_conversation: SavedConversation,
+        saved_context: SavedContext,
         path: PathBuf,
         language_registry: Arc<LanguageRegistry>,
         slash_command_registry: Arc<SlashCommandRegistry>,
         telemetry: Option<Arc<Telemetry>>,
         cx: &mut AsyncAppContext,
     ) -> Result<Model<Self>> {
-        let id = match saved_conversation.id {
+        let id = match saved_context.id {
             Some(id) => Some(id),
             None => Some(Uuid::new_v4().to_string()),
         };
@@ -1171,8 +1140,8 @@ impl Conversation {
         let mut message_anchors = Vec::new();
         let mut next_message_id = MessageId(0);
         let buffer = cx.new_model(|cx| {
-            let mut buffer = Buffer::local(saved_conversation.text, cx);
-            for message in saved_conversation.messages {
+            let mut buffer = Buffer::local(saved_context.text, cx);
+            for message in saved_context.messages {
                 message_anchors.push(MessageAnchor {
                     id: message.id,
                     start: buffer.anchor_before(message.start),
@@ -1197,13 +1166,13 @@ impl Conversation {
             let mut this = Self {
                 id,
                 message_anchors,
-                messages_metadata: saved_conversation.message_metadata,
+                messages_metadata: saved_context.message_metadata,
                 next_message_id,
                 edit_suggestions: Vec::new(),
                 pending_slash_commands: Vec::new(),
                 edits_since_last_slash_command_parse,
                 summary: Some(Summary {
-                    text: saved_conversation.summary,
+                    text: saved_context.summary,
                     done: true,
                 }),
                 pending_summary: Task::ready(None),
@@ -1249,7 +1218,7 @@ impl Conversation {
             self.count_remaining_tokens(cx);
             self.reparse_edit_suggestions(cx);
             self.reparse_slash_commands(cx);
-            cx.emit(ConversationEvent::MessagesEdited);
+            cx.emit(ContextEvent::MessagesEdited);
         }
     }
 
@@ -1346,7 +1315,7 @@ impl Conversation {
         }
 
         if !updated.is_empty() || !removed.is_empty() {
-            cx.emit(ConversationEvent::PendingSlashCommandsUpdated { removed, updated });
+            cx.emit(ContextEvent::PendingSlashCommandsUpdated { removed, updated });
         }
     }
 
@@ -1405,7 +1374,7 @@ impl Conversation {
             self.edit_suggestions
                 .splice(start_ix..end_ix, new_edit_suggestions);
         });
-        cx.emit(ConversationEvent::EditSuggestionsChanged);
+        cx.emit(ContextEvent::EditSuggestionsChanged);
         cx.notify();
     }
 
@@ -1499,7 +1468,7 @@ impl Conversation {
                                 })
                                 .collect::<Vec<_>>();
                             sections.sort_by(|a, b| a.range.cmp(&b.range, buffer));
-                            ConversationEvent::SlashCommandFinished {
+                            ContextEvent::SlashCommandFinished {
                                 output_range: buffer.anchor_after(start)
                                     ..buffer.anchor_before(new_end),
                                 sections,
@@ -1514,7 +1483,7 @@ impl Conversation {
                         {
                             pending_command.status =
                                 PendingSlashCommandStatus::Error(error.to_string());
-                            cx.emit(ConversationEvent::PendingSlashCommandsUpdated {
+                            cx.emit(ContextEvent::PendingSlashCommandsUpdated {
                                 removed: vec![pending_command.source_range.clone()],
                                 updated: vec![pending_command.clone()],
                             });
@@ -1529,7 +1498,7 @@ impl Conversation {
             pending_command.status = PendingSlashCommandStatus::Running {
                 _task: insert_output_task.shared(),
             };
-            cx.emit(ConversationEvent::PendingSlashCommandsUpdated {
+            cx.emit(ContextEvent::PendingSlashCommandsUpdated {
                 removed: vec![pending_command.source_range.clone()],
                 updated: vec![pending_command.clone()],
             });
@@ -1644,7 +1613,7 @@ impl Conversation {
                                     message_start_offset..message_new_end_offset
                                 });
                                 this.reparse_edit_suggestions_in_range(message_range, cx);
-                                cx.emit(ConversationEvent::StreamedCompletion);
+                                cx.emit(ContextEvent::StreamedCompletion);
 
                                 Some(())
                             })?;
@@ -1687,7 +1656,7 @@ impl Conversation {
                                 );
                             }
 
-                            cx.emit(ConversationEvent::MessagesEdited);
+                            cx.emit(ContextEvent::MessagesEdited);
                         }
                     })
                     .ok();
@@ -1725,7 +1694,7 @@ impl Conversation {
         for id in ids {
             if let Some(metadata) = self.messages_metadata.get_mut(&id) {
                 metadata.role.cycle();
-                cx.emit(ConversationEvent::MessagesEdited);
+                cx.emit(ContextEvent::MessagesEdited);
                 cx.notify();
             }
         }
@@ -1768,7 +1737,7 @@ impl Conversation {
                 .insert(next_message_ix, message.clone());
             self.messages_metadata
                 .insert(message.id, MessageMetadata { role, status });
-            cx.emit(ConversationEvent::MessagesEdited);
+            cx.emit(ContextEvent::MessagesEdited);
             Some(message)
         } else {
             None
@@ -1846,7 +1815,7 @@ impl Conversation {
                     }
 
                     let selection = if let Some(prefix_end) = prefix_end {
-                        cx.emit(ConversationEvent::MessagesEdited);
+                        cx.emit(ContextEvent::MessagesEdited);
                         MessageAnchor {
                             id: MessageId(post_inc(&mut self.next_message_id.0)),
                             start: self.buffer.read(cx).anchor_before(prefix_end),
@@ -1875,7 +1844,7 @@ impl Conversation {
                 };
 
             if !edited_buffer {
-                cx.emit(ConversationEvent::MessagesEdited);
+                cx.emit(ContextEvent::MessagesEdited);
             }
             new_messages
         } else {
@@ -1894,8 +1863,7 @@ impl Conversation {
                 .map(|message| message.to_request_message(self.buffer.read(cx)))
                 .chain(Some(LanguageModelRequestMessage {
                     role: Role::User,
-                    content: "Summarize the conversation into a short title without punctuation."
-                        .into(),
+                    content: "Summarize the context into a short title without punctuation.".into(),
                 }));
             let request = LanguageModelRequest {
                 model: CompletionProvider::global(cx).model(),
@@ -1915,7 +1883,7 @@ impl Conversation {
                         this.update(&mut cx, |this, cx| {
                             let summary = this.summary.get_or_insert(Default::default());
                             summary.text.extend(lines.next());
-                            cx.emit(ConversationEvent::SummaryChanged);
+                            cx.emit(ContextEvent::SummaryChanged);
                         })?;
 
                         // Stop if the LLM generated multiple lines.
@@ -1927,7 +1895,7 @@ impl Conversation {
                     this.update(&mut cx, |this, cx| {
                         if let Some(summary) = this.summary.as_mut() {
                             summary.done = true;
-                            cx.emit(ConversationEvent::SummaryChanged);
+                            cx.emit(ContextEvent::SummaryChanged);
                         }
                     })?;
 
@@ -2014,7 +1982,7 @@ impl Conversation {
         &mut self,
         debounce: Option<Duration>,
         fs: Arc<dyn Fs>,
-        cx: &mut ModelContext<Conversation>,
+        cx: &mut ModelContext<Context>,
     ) {
         self.pending_save = cx.spawn(|this, mut cx| async move {
             if let Some(debounce) = debounce {
@@ -2036,14 +2004,14 @@ impl Conversation {
             })?;
 
             if let Some(summary) = summary {
-                let conversation = this.read_with(&cx, |this, cx| this.serialize(cx))?;
+                let context = this.read_with(&cx, |this, cx| this.serialize(cx))?;
                 let path = if let Some(old_path) = old_path {
                     old_path
                 } else {
                     let mut discriminant = 1;
                     let mut new_path;
                     loop {
-                        new_path = CONVERSATIONS_DIR.join(&format!(
+                        new_path = CONTEXTS_DIR.join(&format!(
                             "{} - {}.zed.json",
                             summary.trim(),
                             discriminant
@@ -2057,8 +2025,8 @@ impl Conversation {
                     new_path
                 };
 
-                fs.create_dir(CONVERSATIONS_DIR.as_ref()).await?;
-                fs.atomic_write(path.clone(), serde_json::to_string(&conversation).unwrap())
+                fs.create_dir(CONTEXTS_DIR.as_ref()).await?;
+                fs.atomic_write(path.clone(), serde_json::to_string(&context).unwrap())
                     .await?;
                 this.update(&mut cx, |this, _| this.path = Some(path))?;
             }
@@ -2181,7 +2149,7 @@ struct PendingCompletion {
     _task: Task<()>,
 }
 
-enum ConversationEditorEvent {
+enum ContextEditorEvent {
     TabContentChanged,
 }
 
@@ -2191,8 +2159,8 @@ struct ScrollPosition {
     cursor: Anchor,
 }
 
-pub struct ConversationEditor {
-    conversation: Model<Conversation>,
+pub struct ContextEditor {
+    context: Model<Context>,
     fs: Arc<dyn Fs>,
     workspace: WeakView<Workspace>,
     slash_command_registry: Arc<SlashCommandRegistry>,
@@ -2204,7 +2172,7 @@ pub struct ConversationEditor {
     _subscriptions: Vec<Subscription>,
 }
 
-impl ConversationEditor {
+impl ContextEditor {
     fn new(
         language_registry: Arc<LanguageRegistry>,
         slash_command_registry: Arc<SlashCommandRegistry>,
@@ -2216,8 +2184,8 @@ impl ConversationEditor {
         let project = workspace.read(cx).project().clone();
         let lsp_adapter_delegate = make_lsp_adapter_delegate(&project, cx).log_err();
 
-        let conversation = cx.new_model(|cx| {
-            Conversation::new(
+        let context = cx.new_model(|cx| {
+            Context::new(
                 language_registry,
                 slash_command_registry,
                 Some(telemetry),
@@ -2225,20 +2193,19 @@ impl ConversationEditor {
             )
         });
 
-        let mut this =
-            Self::for_conversation(conversation, fs, workspace, lsp_adapter_delegate, cx);
+        let mut this = Self::for_context(context, fs, workspace, lsp_adapter_delegate, cx);
         this.insert_default_prompt(cx);
         this
     }
 
-    fn for_conversation(
-        conversation: Model<Conversation>,
+    fn for_context(
+        context: Model<Context>,
         fs: Arc<dyn Fs>,
         workspace: View<Workspace>,
         lsp_adapter_delegate: Option<Arc<dyn LspAdapterDelegate>>,
         cx: &mut ViewContext<Self>,
     ) -> Self {
-        let slash_command_registry = conversation.read(cx).slash_command_registry.clone();
+        let slash_command_registry = context.read(cx).slash_command_registry.clone();
 
         let completion_provider = SlashCommandCompletionProvider::new(
             slash_command_registry.clone(),
@@ -2247,7 +2214,7 @@ impl ConversationEditor {
         );
 
         let editor = cx.new_view(|cx| {
-            let mut editor = Editor::for_buffer(conversation.read(cx).buffer.clone(), None, cx);
+            let mut editor = Editor::for_buffer(context.read(cx).buffer.clone(), None, cx);
             editor.set_soft_wrap_mode(SoftWrap::EditorWidth, cx);
             editor.set_show_line_numbers(false, cx);
             editor.set_show_git_diff_gutter(false, cx);
@@ -2259,13 +2226,13 @@ impl ConversationEditor {
         });
 
         let _subscriptions = vec![
-            cx.observe(&conversation, |_, _, cx| cx.notify()),
-            cx.subscribe(&conversation, Self::handle_conversation_event),
+            cx.observe(&context, |_, _, cx| cx.notify()),
+            cx.subscribe(&context, Self::handle_context_event),
             cx.subscribe(&editor, Self::handle_editor_event),
         ];
 
         let mut this = Self {
-            conversation,
+            context,
             editor,
             slash_command_registry,
             lsp_adapter_delegate,
@@ -2286,14 +2253,14 @@ impl ConversationEditor {
             editor.insert(&format!("/{command_name}"), cx)
         });
         self.split(&Split, cx);
-        let command = self.conversation.update(cx, |conversation, cx| {
-            conversation
+        let command = self.context.update(cx, |context, cx| {
+            context
                 .messages_metadata
                 .get_mut(&MessageId::default())
                 .unwrap()
                 .role = Role::System;
-            conversation.reparse_slash_commands(cx);
-            conversation.pending_slash_commands[0].clone()
+            context.reparse_slash_commands(cx);
+            context.pending_slash_commands[0].clone()
         });
 
         self.run_command(

crates/assistant/src/conversation_store.rs → crates/assistant/src/context_store.rs 🔗

@@ -9,7 +9,7 @@ use regex::Regex;
 use serde::{Deserialize, Serialize};
 use std::{cmp::Reverse, ffi::OsStr, path::PathBuf, sync::Arc, time::Duration};
 use ui::Context;
-use util::{paths::CONVERSATIONS_DIR, ResultExt, TryFutureExt};
+use util::{paths::CONTEXTS_DIR, ResultExt, TryFutureExt};
 
 #[derive(Serialize, Deserialize)]
 pub struct SavedMessage {
@@ -18,7 +18,7 @@ pub struct SavedMessage {
 }
 
 #[derive(Serialize, Deserialize)]
-pub struct SavedConversation {
+pub struct SavedContext {
     pub id: Option<String>,
     pub zed: String,
     pub version: String,
@@ -28,12 +28,12 @@ pub struct SavedConversation {
     pub summary: String,
 }
 
-impl SavedConversation {
+impl SavedContext {
     pub const VERSION: &'static str = "0.2.0";
 }
 
 #[derive(Serialize, Deserialize)]
-struct SavedConversationV0_1_0 {
+struct SavedContextV0_1_0 {
     id: Option<String>,
     zed: String,
     version: String,
@@ -46,28 +46,26 @@ struct SavedConversationV0_1_0 {
 }
 
 #[derive(Clone)]
-pub struct SavedConversationMetadata {
+pub struct SavedContextMetadata {
     pub title: String,
     pub path: PathBuf,
     pub mtime: chrono::DateTime<chrono::Local>,
 }
 
-pub struct ConversationStore {
-    conversations_metadata: Vec<SavedConversationMetadata>,
+pub struct ContextStore {
+    contexts_metadata: Vec<SavedContextMetadata>,
     fs: Arc<dyn Fs>,
     _watch_updates: Task<Option<()>>,
 }
 
-impl ConversationStore {
+impl ContextStore {
     pub fn new(fs: Arc<dyn Fs>, cx: &mut AppContext) -> Task<Result<Model<Self>>> {
         cx.spawn(|mut cx| async move {
-            const CONVERSATION_WATCH_DURATION: Duration = Duration::from_millis(100);
-            let (mut events, _) = fs
-                .watch(&CONVERSATIONS_DIR, CONVERSATION_WATCH_DURATION)
-                .await;
+            const CONTEXT_WATCH_DURATION: Duration = Duration::from_millis(100);
+            let (mut events, _) = fs.watch(&CONTEXTS_DIR, CONTEXT_WATCH_DURATION).await;
 
             let this = cx.new_model(|cx: &mut ModelContext<Self>| Self {
-                conversations_metadata: Vec::new(),
+                contexts_metadata: Vec::new(),
                 fs,
                 _watch_updates: cx.spawn(|this, mut cx| {
                     async move {
@@ -88,46 +86,41 @@ impl ConversationStore {
         })
     }
 
-    pub fn load(&self, path: PathBuf, cx: &AppContext) -> Task<Result<SavedConversation>> {
+    pub fn load(&self, path: PathBuf, cx: &AppContext) -> Task<Result<SavedContext>> {
         let fs = self.fs.clone();
         cx.background_executor().spawn(async move {
-            let saved_conversation = fs.load(&path).await?;
-            let saved_conversation_json =
-                serde_json::from_str::<serde_json::Value>(&saved_conversation)?;
-            match saved_conversation_json
+            let saved_context = fs.load(&path).await?;
+            let saved_context_json = serde_json::from_str::<serde_json::Value>(&saved_context)?;
+            match saved_context_json
                 .get("version")
                 .ok_or_else(|| anyhow!("version not found"))?
             {
                 serde_json::Value::String(version) => match version.as_str() {
-                    SavedConversation::VERSION => Ok(serde_json::from_value::<SavedConversation>(
-                        saved_conversation_json,
-                    )?),
+                    SavedContext::VERSION => {
+                        Ok(serde_json::from_value::<SavedContext>(saved_context_json)?)
+                    }
                     "0.1.0" => {
-                        let saved_conversation = serde_json::from_value::<SavedConversationV0_1_0>(
-                            saved_conversation_json,
-                        )?;
-                        Ok(SavedConversation {
-                            id: saved_conversation.id,
-                            zed: saved_conversation.zed,
-                            version: saved_conversation.version,
-                            text: saved_conversation.text,
-                            messages: saved_conversation.messages,
-                            message_metadata: saved_conversation.message_metadata,
-                            summary: saved_conversation.summary,
+                        let saved_context =
+                            serde_json::from_value::<SavedContextV0_1_0>(saved_context_json)?;
+                        Ok(SavedContext {
+                            id: saved_context.id,
+                            zed: saved_context.zed,
+                            version: saved_context.version,
+                            text: saved_context.text,
+                            messages: saved_context.messages,
+                            message_metadata: saved_context.message_metadata,
+                            summary: saved_context.summary,
                         })
                     }
-                    _ => Err(anyhow!(
-                        "unrecognized saved conversation version: {}",
-                        version
-                    )),
+                    _ => Err(anyhow!("unrecognized saved context version: {}", version)),
                 },
-                _ => Err(anyhow!("version not found on saved conversation")),
+                _ => Err(anyhow!("version not found on saved context")),
             }
         })
     }
 
-    pub fn search(&self, query: String, cx: &AppContext) -> Task<Vec<SavedConversationMetadata>> {
-        let metadata = self.conversations_metadata.clone();
+    pub fn search(&self, query: String, cx: &AppContext) -> Task<Vec<SavedContextMetadata>> {
+        let metadata = self.contexts_metadata.clone();
         let executor = cx.background_executor().clone();
         cx.background_executor().spawn(async move {
             if query.is_empty() {
@@ -159,10 +152,10 @@ impl ConversationStore {
     fn reload(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
         let fs = self.fs.clone();
         cx.spawn(|this, mut cx| async move {
-            fs.create_dir(&CONVERSATIONS_DIR).await?;
+            fs.create_dir(&CONTEXTS_DIR).await?;
 
-            let mut paths = fs.read_dir(&CONVERSATIONS_DIR).await?;
-            let mut conversations = Vec::<SavedConversationMetadata>::new();
+            let mut paths = fs.read_dir(&CONTEXTS_DIR).await?;
+            let mut contexts = Vec::<SavedContextMetadata>::new();
             while let Some(path) = paths.next().await {
                 let path = path?;
                 if path.extension() != Some(OsStr::new("json")) {
@@ -178,13 +171,13 @@ impl ConversationStore {
                     .and_then(|name| name.to_str())
                     .zip(metadata)
                 {
-                    // This is used to filter out conversations saved by the new assistant.
+                    // This is used to filter out contexts saved by the new assistant.
                     if !re.is_match(file_name) {
                         continue;
                     }
 
                     if let Some(title) = re.replace(file_name, "").lines().next() {
-                        conversations.push(SavedConversationMetadata {
+                        contexts.push(SavedContextMetadata {
                             title: title.to_string(),
                             path,
                             mtime: metadata.mtime.into(),
@@ -192,10 +185,10 @@ impl ConversationStore {
                     }
                 }
             }
-            conversations.sort_unstable_by_key(|conversation| Reverse(conversation.mtime));
+            contexts.sort_unstable_by_key(|context| Reverse(context.mtime));
 
             this.update(&mut cx, |this, cx| {
-                this.conversations_metadata = conversations;
+                this.contexts_metadata = contexts;
                 cx.notify();
             })
         })

crates/assistant/src/inline_assistant.rs 🔗

@@ -66,7 +66,7 @@ impl InlineAssistant {
         &mut self,
         editor: &View<Editor>,
         workspace: Option<WeakView<Workspace>>,
-        include_conversation: bool,
+        include_context: bool,
         cx: &mut WindowContext,
     ) {
         let selection = editor.read(cx).selections.newest_anchor().clone();
@@ -144,7 +144,7 @@ impl InlineAssistant {
         self.pending_assists.insert(
             inline_assist_id,
             PendingInlineAssist {
-                include_conversation,
+                include_context,
                 editor: editor.downgrade(),
                 inline_assist_editor: Some((block_id, inline_assist_editor.clone())),
                 codegen: codegen.clone(),
@@ -375,11 +375,11 @@ impl InlineAssistant {
             return;
         };
 
-        let conversation = if pending_assist.include_conversation {
+        let context = if pending_assist.include_context {
             pending_assist.workspace.as_ref().and_then(|workspace| {
                 let workspace = workspace.upgrade()?.read(cx);
                 let assistant_panel = workspace.panel::<AssistantPanel>(cx)?;
-                assistant_panel.read(cx).active_conversation(cx)
+                assistant_panel.read(cx).active_context(cx)
             })
         } else {
             None
@@ -461,8 +461,8 @@ impl InlineAssistant {
         });
 
         let mut messages = Vec::new();
-        if let Some(conversation) = conversation {
-            let request = conversation.read(cx).to_completion_request(cx);
+        if let Some(context) = context {
+            let request = context.read(cx).to_completion_request(cx);
             messages = request.messages;
         }
         let model = CompletionProvider::global(cx).model();
@@ -818,7 +818,7 @@ struct PendingInlineAssist {
     codegen: Model<Codegen>,
     _subscriptions: Vec<Subscription>,
     workspace: Option<WeakView<Workspace>>,
-    include_conversation: bool,
+    include_context: bool,
 }
 
 #[derive(Debug)]

crates/assistant/src/slash_command.rs 🔗

@@ -1,4 +1,4 @@
-use crate::assistant_panel::ConversationEditor;
+use crate::assistant_panel::ContextEditor;
 use anyhow::Result;
 pub use assistant_slash_command::{SlashCommand, SlashCommandOutput, SlashCommandRegistry};
 use editor::{CompletionProvider, Editor};
@@ -29,7 +29,7 @@ pub mod tabs_command;
 pub(crate) struct SlashCommandCompletionProvider {
     commands: Arc<SlashCommandRegistry>,
     cancel_flag: Mutex<Arc<AtomicBool>>,
-    editor: Option<WeakView<ConversationEditor>>,
+    editor: Option<WeakView<ContextEditor>>,
     workspace: Option<WeakView<Workspace>>,
 }
 
@@ -43,7 +43,7 @@ pub(crate) struct SlashCommandLine {
 impl SlashCommandCompletionProvider {
     pub fn new(
         commands: Arc<SlashCommandRegistry>,
-        editor: Option<WeakView<ConversationEditor>>,
+        editor: Option<WeakView<ContextEditor>>,
         workspace: Option<WeakView<Workspace>>,
     ) -> Self {
         Self {

crates/util/src/paths.rs 🔗

@@ -21,7 +21,7 @@ lazy_static::lazy_static! {
     } else {
         HOME.join(".config").join("zed")
     };
-    pub static ref CONVERSATIONS_DIR: PathBuf = if cfg!(target_os = "macos") {
+    pub static ref CONTEXTS_DIR: PathBuf = if cfg!(target_os = "macos") {
         CONFIG_DIR.join("conversations")
     } else {
         SUPPORT_DIR.join("conversations")