repl: Factor out ReplStore (#14970)

This PR factors a `ReplStore` out of the `RuntimePanel`.

Since we're planning to remove the `RuntimePanel` and replace it with an
ephemeral tab that can be opened, we need the kernel specifications and
sessions to have somewhere long-lived that they can reside in.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-07-22 12:46:33 -04:00 committed by GitHub
parent 2e23527e09
commit 28baa56e3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 264 additions and 185 deletions

View file

@ -1,11 +1,13 @@
use async_dispatcher::{set_dispatcher, Dispatcher, Runnable};
use gpui::{AppContext, PlatformDispatcher};
use project::Fs;
use settings::Settings as _;
use std::{sync::Arc, time::Duration};
mod jupyter_settings;
mod kernels;
mod outputs;
mod repl_store;
mod runtime_panel;
mod session;
mod stdio;
@ -17,6 +19,8 @@ pub use runtime_panel::{RuntimePanel, SessionSupport};
pub use runtimelib::ExecutionState;
pub use session::Session;
use crate::repl_store::ReplStore;
fn zed_dispatcher(cx: &mut AppContext) -> impl Dispatcher {
struct ZedDispatcher {
dispatcher: Arc<dyn PlatformDispatcher>,
@ -41,8 +45,10 @@ fn zed_dispatcher(cx: &mut AppContext) -> impl Dispatcher {
}
}
pub fn init(cx: &mut AppContext) {
pub fn init(fs: Arc<dyn Fs>, cx: &mut AppContext) {
set_dispatcher(zed_dispatcher(cx));
JupyterSettings::register(cx);
runtime_panel::init(cx)
editor::init_settings(cx);
runtime_panel::init(cx);
ReplStore::init(fs, cx);
}