1use collections::HashMap;
2
3use editor::EditorSettings;
4use gpui::App;
5use settings::Settings;
6
7#[derive(Debug, Default)]
8pub struct JupyterSettings {
9 pub kernel_selections: HashMap<String, String>,
10}
11
12impl JupyterSettings {
13 pub fn enabled(cx: &App) -> bool {
14 // In order to avoid a circular dependency between `editor` and `repl` crates,
15 // we put the `enable` flag on its settings.
16 // This allows the editor to set up context for key bindings/actions.
17 EditorSettings::jupyter_enabled(cx)
18 }
19}
20
21impl Settings for JupyterSettings {
22 fn from_settings(content: &settings::SettingsContent) -> Self {
23 let jupyter = content.editor.jupyter.clone().unwrap();
24 Self {
25 kernel_selections: jupyter.kernel_selections.unwrap_or_default(),
26 }
27 }
28}