Files
oak-gpui/crates/repl/src/repl.rs
T
c50b561e1c Expose REPL Settings (#37927)
Closes #37829

This PR introduces and exposes `REPLSettings` to control the number of
lines and columns in the REPL. These settings are integrated into the
existing configuration system, allowing for customization and management
through the standard settings interface.

#### Changes
- Added `REPLSettings` struct with `max_number_of_lines` and
`max_number_of_columns` fields.
- Integrated `REPLSettings` with the settings system by implementing the
`Settings` trait.
- Ensured compatibility with the workspace and existing settings
infrastructure.

Release Notes:

- Add configuration "repl" to settings to configure max lines and
columns for repl.

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2025-09-13 23:17:44 +00:00

64 lines
1.9 KiB
Rust

pub mod components;
mod jupyter_settings;
pub mod kernels;
pub mod notebook;
mod outputs;
mod repl_editor;
mod repl_sessions_ui;
mod repl_settings;
mod repl_store;
mod session;
use std::{sync::Arc, time::Duration};
use async_dispatcher::{Dispatcher, Runnable, set_dispatcher};
use gpui::{App, PlatformDispatcher};
use project::Fs;
pub use runtimelib::ExecutionState;
use settings::Settings as _;
pub use crate::jupyter_settings::JupyterSettings;
pub use crate::kernels::{Kernel, KernelSpecification, KernelStatus};
pub use crate::repl_editor::*;
pub use crate::repl_sessions_ui::{
ClearOutputs, Interrupt, ReplSessionsPage, Restart, Run, Sessions, Shutdown,
};
pub use crate::repl_settings::ReplSettings;
use crate::repl_store::ReplStore;
pub use crate::session::Session;
pub const KERNEL_DOCS_URL: &str = "https://zed.dev/docs/repl#changing-kernels";
pub fn init(fs: Arc<dyn Fs>, cx: &mut App) {
set_dispatcher(zed_dispatcher(cx));
JupyterSettings::register(cx);
::editor::init_settings(cx);
ReplSettings::register(cx);
repl_sessions_ui::init(cx);
ReplStore::init(fs, cx);
}
fn zed_dispatcher(cx: &mut App) -> 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(),
}
}