assistant_context_editor.rs

 1mod context;
 2mod context_editor;
 3mod context_history;
 4mod context_store;
 5mod slash_command;
 6mod slash_command_picker;
 7
 8use std::sync::Arc;
 9
10use client::Client;
11use gpui::{App, Context};
12use workspace::Workspace;
13
14pub use crate::context::*;
15pub use crate::context_editor::*;
16pub use crate::context_history::*;
17pub use crate::context_store::*;
18pub use crate::slash_command::*;
19
20pub fn init(client: Arc<Client>, cx: &mut App) {
21    context_store::init(&client.into());
22    workspace::FollowableViewRegistry::register::<ContextEditor>(cx);
23
24    cx.observe_new(
25        |workspace: &mut Workspace, _window, _cx: &mut Context<Workspace>| {
26            workspace
27                .register_action(ContextEditor::quote_selection)
28                .register_action(ContextEditor::insert_selection)
29                .register_action(ContextEditor::copy_code)
30                .register_action(ContextEditor::handle_insert_dragged_files);
31        },
32    )
33    .detach();
34}