Split terminal API into shell and task

This commit is contained in:
Lukas Wirth 2025-08-18 16:43:32 +02:00
parent 11545c669e
commit 0ce4dbb641
10 changed files with 396 additions and 658 deletions

View file

@ -3,7 +3,7 @@ use async_recursion::async_recursion;
use collections::HashSet;
use futures::{StreamExt as _, stream::FuturesUnordered};
use gpui::{AppContext as _, AsyncWindowContext, Axis, Entity, Task, WeakEntity};
use project::{Project, terminals::TerminalKind};
use project::Project;
use serde::{Deserialize, Serialize};
use std::path::{Path, PathBuf};
use ui::{App, Context, Pixels, Window};
@ -242,11 +242,12 @@ async fn deserialize_pane_group(
.update(cx, |workspace, cx| default_working_directory(workspace, cx))
.ok()
.flatten();
let kind = TerminalKind::Shell(
working_directory.as_deref().map(Path::to_path_buf),
);
let terminal =
project.update(cx, |project, cx| project.create_terminal(kind, cx));
let terminal = project.update(cx, |project, cx| {
project.create_terminal_shell(
working_directory.as_deref().map(Path::to_path_buf),
cx,
)
});
Some(Some(terminal))
} else {
Some(None)
@ -255,7 +256,7 @@ async fn deserialize_pane_group(
.ok()
.flatten()?;
if let Some(terminal) = terminal {
let terminal = terminal.await.ok()?;
let terminal = terminal.ok()?;
pane.update_in(cx, |pane, window, cx| {
let terminal_view = Box::new(cx.new(|cx| {
TerminalView::new(