Extract ContextHistory
to assistant_context_editor
(#23437)
This PR extracts the `ContextHistory` to the `assistant_context_editor` crate. Release Notes: - N/A
This commit is contained in:
parent
e59c910845
commit
be407e27f9
7 changed files with 47 additions and 25 deletions
|
@ -1,4 +1,3 @@
|
|||
use crate::context_history::ContextHistory;
|
||||
use crate::{
|
||||
terminal_inline_assistant::TerminalInlineAssistant, DeployHistory, DeployPromptLibrary,
|
||||
InlineAssistant, NewContext, ToggleFocus,
|
||||
|
@ -6,9 +5,9 @@ use crate::{
|
|||
use anyhow::{anyhow, Result};
|
||||
use assistant_context_editor::{
|
||||
make_lsp_adapter_delegate, AssistantPanelDelegate, Context, ContextEditor,
|
||||
ContextEditorToolbarItem, ContextEditorToolbarItemEvent, ContextId, ContextStore,
|
||||
ContextStoreEvent, InsertDraggedFiles, SlashCommandCompletionProvider, ToggleModelSelector,
|
||||
DEFAULT_TAB_TITLE,
|
||||
ContextEditorToolbarItem, ContextEditorToolbarItemEvent, ContextHistory, ContextId,
|
||||
ContextStore, ContextStoreEvent, InsertDraggedFiles, SlashCommandCompletionProvider,
|
||||
ToggleModelSelector, DEFAULT_TAB_TITLE,
|
||||
};
|
||||
use assistant_settings::{AssistantDockPosition, AssistantSettings};
|
||||
use assistant_slash_command::SlashCommandWorkingSet;
|
||||
|
@ -966,12 +965,11 @@ impl AssistantPanel {
|
|||
pane.activate_item(history_item_ix, true, true, cx);
|
||||
});
|
||||
} else {
|
||||
let assistant_panel = cx.view().downgrade();
|
||||
let history = cx.new_view(|cx| {
|
||||
ContextHistory::new(
|
||||
self.project.clone(),
|
||||
self.context_store.clone(),
|
||||
assistant_panel,
|
||||
self.workspace.clone(),
|
||||
cx,
|
||||
)
|
||||
});
|
||||
|
@ -1308,6 +1306,19 @@ impl AssistantPanelDelegate for ConcreteAssistantPanelDelegate {
|
|||
panel.read(cx).active_context_editor(cx)
|
||||
}
|
||||
|
||||
fn open_saved_context(
|
||||
&self,
|
||||
workspace: &mut Workspace,
|
||||
path: PathBuf,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Task<Result<()>> {
|
||||
let Some(panel) = workspace.panel::<AssistantPanel>(cx) else {
|
||||
return Task::ready(Err(anyhow!("no Assistant panel found")));
|
||||
};
|
||||
|
||||
panel.update(cx, |panel, cx| panel.open_saved_context(path, cx))
|
||||
}
|
||||
|
||||
fn open_remote_context(
|
||||
&self,
|
||||
workspace: &mut Workspace,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue