repl: Improve kernelspec discoverability (#15886)

<img width="862" alt="image"
src="https://github.com/user-attachments/assets/ae8c479d-d9f9-4c46-bb1a-be411ab07876">

Release Notes:

- Added additional context about available to kernel sessions
- Fixed bug in kernelspec launch choosing first available kernel
matching the language rather than selected name

---------

Co-authored-by: Jason <jason@zed.dev>
This commit is contained in:
Kyle Kelley 2024-08-06 16:58:56 -07:00 committed by GitHub
parent a54e16b7ea
commit 6065db174a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 97 additions and 30 deletions

View file

@ -37,7 +37,7 @@ pub fn run(editor: WeakView<Editor>, move_down: bool, cx: &mut WindowContext) ->
let kernel_specification = store.update(cx, |store, cx| {
store
.kernelspec(&language, cx)
.kernelspec(language.code_fence_block_name().as_ref(), cx)
.with_context(|| format!("No kernel found for language: {}", language.name()))
})?;
@ -114,7 +114,9 @@ pub fn session(editor: WeakView<Editor>, cx: &mut AppContext) -> SessionSupport
let Some(language) = get_language(editor, cx) else {
return SessionSupport::Unsupported;
};
let kernelspec = store.update(cx, |store, cx| store.kernelspec(&language, cx));
let kernelspec = store.update(cx, |store, cx| {
store.kernelspec(language.code_fence_block_name().as_ref(), cx)
});
match kernelspec {
Some(kernelspec) => SessionSupport::Inactive(Box::new(kernelspec)),