repl: Enable jupyter by default, allow disabling (#14985)

Enables the jupyter feature by default, which is shown only when we have
a kernelspec or know that we (can) support it well (Python,
Deno/TypeScript).

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
Kyle Kelley 2024-07-22 14:30:21 -07:00 committed by GitHub
parent a9397834eb
commit 01392c1329
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 29 additions and 44 deletions

View file

@ -16,7 +16,7 @@ impl JupyterSettings {
// In order to avoid a circular dependency between `editor` and `repl` crates,
// we put the `enable` flag on its settings.
// This allows the editor to set up context for key bindings/actions.
EditorSettings::get_global(cx).jupyter.enabled
EditorSettings::jupyter_enabled(cx)
}
}
@ -61,40 +61,3 @@ impl Settings for JupyterSettings {
Ok(settings)
}
}
#[cfg(test)]
mod tests {
use gpui::{AppContext, UpdateGlobal};
use settings::SettingsStore;
use super::*;
#[gpui::test]
fn test_deserialize_jupyter_settings(cx: &mut AppContext) {
let store = settings::SettingsStore::test(cx);
cx.set_global(store);
EditorSettings::register(cx);
JupyterSettings::register(cx);
assert_eq!(JupyterSettings::enabled(cx), false);
// Setting a custom setting through user settings
SettingsStore::update_global(cx, |store, cx| {
store
.set_user_settings(
r#"{
"jupyter": {
"enabled": true,
"dock": "left",
"default_width": 800.0
}
}"#,
cx,
)
.unwrap();
});
assert_eq!(JupyterSettings::enabled(cx), true);
}
}