repl: Add restart kernel action and improve shutdown (#16609)
- Implement restart kernel functionality - Clean up shutdown process to properly drop messaging and exit status tasks - Refactor kernel state handling for better consistency Closes #16037 Release Notes: - repl: Added restart kernel action - repl: Fixed issue with shutting down kernels that are in a failure state
This commit is contained in:
parent
9f0438b540
commit
2ad9a742dd
7 changed files with 177 additions and 41 deletions
|
@ -168,6 +168,27 @@ pub fn shutdown(editor: WeakView<Editor>, cx: &mut WindowContext) {
|
|||
});
|
||||
}
|
||||
|
||||
pub fn restart(editor: WeakView<Editor>, cx: &mut WindowContext) {
|
||||
let Some(editor) = editor.upgrade() else {
|
||||
return;
|
||||
};
|
||||
|
||||
let entity_id = editor.entity_id();
|
||||
|
||||
let Some(session) = ReplStore::global(cx)
|
||||
.read(cx)
|
||||
.get_session(entity_id)
|
||||
.cloned()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
session.update(cx, |session, cx| {
|
||||
session.restart(cx);
|
||||
cx.notify();
|
||||
});
|
||||
}
|
||||
|
||||
fn cell_range(buffer: &BufferSnapshot, start_row: u32, end_row: u32) -> Range<Point> {
|
||||
let mut snippet_end_row = end_row;
|
||||
while buffer.is_line_blank(snippet_end_row) && snippet_end_row > start_row {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue