Add assistant_context_editor
crate (#23429)
This PR adds a new `assistant_context_editor` crate. This will ultimately house the `ContextEditor` so that it can be consumed by both `assistant` and `assistant2`. For the purposes of this PR, we just introduce the crate and move some supporting constructs to it, such as the `ContextStore`. Release Notes: - N/A
This commit is contained in:
parent
c450cd51ea
commit
9a7f1d1de4
21 changed files with 304 additions and 211 deletions
|
@ -1,4 +1,9 @@
|
|||
use anyhow::Result;
|
||||
use assistant_context_editor::{
|
||||
AssistantPatch, AssistantPatchStatus, CacheStatus, Content, Context, ContextEvent, ContextId,
|
||||
InvokedSlashCommandId, InvokedSlashCommandStatus, Message, MessageId, MessageMetadata,
|
||||
MessageStatus, ParsedSlashCommand, PendingSlashCommandStatus, RequestType,
|
||||
};
|
||||
use assistant_settings::AssistantSettings;
|
||||
use assistant_slash_command::{SlashCommand, SlashCommandOutputSection, SlashCommandWorkingSet};
|
||||
use assistant_slash_commands::{
|
||||
|
@ -58,11 +63,8 @@ use workspace::{
|
|||
|
||||
use crate::{
|
||||
humanize_token_count, slash_command::SlashCommandCompletionProvider, slash_command_picker,
|
||||
Assist, AssistantPanel, AssistantPatch, AssistantPatchStatus, CacheStatus, ConfirmCommand,
|
||||
Content, Context, ContextEvent, ContextId, CopyCode, CycleMessageRole, Edit,
|
||||
InsertDraggedFiles, InsertIntoEditor, InvokedSlashCommandId, InvokedSlashCommandStatus,
|
||||
Message, MessageId, MessageMetadata, MessageStatus, ParsedSlashCommand,
|
||||
PendingSlashCommandStatus, QuoteSelection, RequestType, Split, ToggleModelSelector,
|
||||
Assist, AssistantPanel, ConfirmCommand, CopyCode, CycleMessageRole, Edit, InsertDraggedFiles,
|
||||
InsertIntoEditor, QuoteSelection, Split, ToggleModelSelector,
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
@ -138,7 +140,7 @@ impl ContextEditor {
|
|||
cx: &mut ViewContext<Self>,
|
||||
) -> Self {
|
||||
let completion_provider = SlashCommandCompletionProvider::new(
|
||||
context.read(cx).slash_commands.clone(),
|
||||
context.read(cx).slash_commands().clone(),
|
||||
Some(cx.view().downgrade()),
|
||||
Some(workspace.clone()),
|
||||
);
|
||||
|
@ -167,8 +169,8 @@ impl ContextEditor {
|
|||
|
||||
let sections = context.read(cx).slash_command_output_sections().to_vec();
|
||||
let patch_ranges = context.read(cx).patch_ranges().collect::<Vec<_>>();
|
||||
let slash_commands = context.read(cx).slash_commands.clone();
|
||||
let tools = context.read(cx).tools.clone();
|
||||
let slash_commands = context.read(cx).slash_commands().clone();
|
||||
let tools = context.read(cx).tools().clone();
|
||||
let mut this = Self {
|
||||
context,
|
||||
slash_commands,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue