assistant_context_editor.rs

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