Show kernel options in a picker (#20274)

Closes #18341

* [x] Remove "Change Kernel" Doc link from REPL menu
* [x] Remove chevron
* [x] Set a higher min width
* [x] Include the language along with the kernel name

Future PRs will address

* Add support for Python envs (#18291, #16757, #15563)
* Add support for Remote kernels
* Project settings support (#16898)

Release Notes:

- Added kernel picker for repl

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
This commit is contained in:
Kyle Kelley 2024-11-07 17:59:53 -08:00 committed by GitHub
parent f6d4a73c34
commit 36fe364c05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 492 additions and 63 deletions

View file

@ -1,8 +1,8 @@
use crate::components::KernelListItem;
use crate::KernelStatus;
use crate::{
kernels::{Kernel, KernelSpecification, RunningKernel},
outputs::{ExecutionStatus, ExecutionView},
KernelStatus,
};
use client::telemetry::Telemetry;
use collections::{HashMap, HashSet};
@ -224,7 +224,7 @@ impl Session {
}
fn start_kernel(&mut self, cx: &mut ViewContext<Self>) {
let kernel_language = self.kernel_specification.kernelspec.language.clone();
let kernel_language = self.kernel_specification.language();
let entity_id = self.editor.entity_id();
let working_directory = self
.editor
@ -233,7 +233,7 @@ impl Session {
.unwrap_or_else(temp_dir);
self.telemetry.report_repl_event(
kernel_language.clone(),
kernel_language.into(),
KernelStatus::Starting.to_string(),
cx.entity_id().to_string(),
);
@ -556,7 +556,7 @@ impl Session {
self.kernel.set_execution_state(&status.execution_state);
self.telemetry.report_repl_event(
self.kernel_specification.kernelspec.language.clone(),
self.kernel_specification.language().into(),
KernelStatus::from(&self.kernel).to_string(),
cx.entity_id().to_string(),
);
@ -607,7 +607,7 @@ impl Session {
}
let kernel_status = KernelStatus::from(&kernel).to_string();
let kernel_language = self.kernel_specification.kernelspec.language.clone();
let kernel_language = self.kernel_specification.language().into();
self.telemetry.report_repl_event(
kernel_language,
@ -749,7 +749,7 @@ impl Render for Session {
Kernel::Shutdown => Color::Disabled,
Kernel::Restarting => Color::Modified,
})
.child(Label::new(self.kernel_specification.name.clone()))
.child(Label::new(self.kernel_specification.name()))
.children(status_text.map(|status_text| Label::new(format!("({status_text})"))))
.button(
Button::new("shutdown", "Shutdown")