TODO: - [x] Actions run from menu not firing - [x] Menu differentiates idle and busy for running kernel Menu States: - [x] No session && no support known No session && no kernel installed for languages of known support - (TODO after) Intro to REPL - [x] Link to docs No session but can start one - [x] Start REPL - (TODO after) More info -> Docs? Yes Session - [x] Info: Kernel name, language example: chatlab-3.7-adsf87fsa (Python) example: condapy-3.7 (Python) - [x] Change Kernel -> https://zed.dev/docs/repl#change-kernel - --- - [x] Run - [x] Interrupt - [x] Clear Outputs - --- - [x] Shutdown (Release notes left empty as the change will be documented in the REPL release!) Reserved for a follow on PR: ``` - [ ] Status should update when the menu is open (missing `cx.notify`?) - [ ] Shutdown all kernels action - [ ] Restart action - [ ] [Default kernel changed - restart (this kernel) to apply] // todo!(kyle): need some kind of state thing that says if this has happened ``` Release Notes: - N/A --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com> Co-authored-by: Kyle Kelley <rgbkrk@gmail.com> Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
49 lines
1.5 KiB
Rust
49 lines
1.5 KiB
Rust
use async_dispatcher::{set_dispatcher, Dispatcher, Runnable};
|
|
use gpui::{AppContext, PlatformDispatcher};
|
|
use settings::Settings as _;
|
|
use std::{sync::Arc, time::Duration};
|
|
|
|
mod jupyter_settings;
|
|
mod kernels;
|
|
mod outputs;
|
|
mod runtime_panel;
|
|
mod session;
|
|
mod stdio;
|
|
|
|
pub use jupyter_settings::JupyterSettings;
|
|
pub use kernels::{Kernel, KernelSpecification};
|
|
pub use runtime_panel::{ClearOutputs, Interrupt, Run, Shutdown};
|
|
pub use runtime_panel::{RuntimePanel, SessionSupport};
|
|
pub use runtimelib::ExecutionState;
|
|
pub use session::Session;
|
|
|
|
fn zed_dispatcher(cx: &mut AppContext) -> impl Dispatcher {
|
|
struct ZedDispatcher {
|
|
dispatcher: Arc<dyn PlatformDispatcher>,
|
|
}
|
|
|
|
// PlatformDispatcher is _super_ close to the same interface we put in
|
|
// async-dispatcher, except for the task label in dispatch. Later we should
|
|
// just make that consistent so we have this dispatcher ready to go for
|
|
// other crates in Zed.
|
|
impl Dispatcher for ZedDispatcher {
|
|
fn dispatch(&self, runnable: Runnable) {
|
|
self.dispatcher.dispatch(runnable, None)
|
|
}
|
|
|
|
fn dispatch_after(&self, duration: Duration, runnable: Runnable) {
|
|
self.dispatcher.dispatch_after(duration, runnable);
|
|
}
|
|
}
|
|
|
|
ZedDispatcher {
|
|
dispatcher: cx.background_executor().dispatcher.clone(),
|
|
}
|
|
}
|
|
|
|
pub fn init(cx: &mut AppContext) {
|
|
set_dispatcher(zed_dispatcher(cx));
|
|
JupyterSettings::register(cx);
|
|
runtime_panel::init(cx)
|
|
}
|