debugger: Run build in terminal (#29645)

Currently contains the pre-work of making sessions creatable without a
definition, but still need to change the spawn in terminal
to use the running session

Release Notes:

- N/A

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This commit is contained in:
Conrad Irwin 2025-05-05 21:08:14 +01:00 committed by GitHub
parent c12e6376b8
commit ff215b4f11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 695 additions and 622 deletions

View file

@ -50,7 +50,7 @@ use std::{
sync::{Arc, Once},
};
use task::{DebugScenario, SpawnInTerminal};
use util::ResultExt as _;
use util::{ResultExt as _, merge_json_value_into};
use worktree::Worktree;
#[derive(Debug)]
@ -393,7 +393,8 @@ impl DapStore {
pub fn new_session(
&mut self,
template: DebugTaskDefinition,
label: SharedString,
adapter: DebugAdapterName,
parent_session: Option<Entity<Session>>,
cx: &mut Context<Self>,
) -> Entity<Session> {
@ -409,7 +410,8 @@ impl DapStore {
self.breakpoint_store.clone(),
session_id,
parent_session,
template.clone(),
label,
adapter,
cx,
);
@ -435,6 +437,7 @@ impl DapStore {
pub fn boot_session(
&self,
session: Entity<Session>,
definition: DebugTaskDefinition,
cx: &mut Context<Self>,
) -> Task<Result<()>> {
let Some(worktree) = self.worktree_store.read(cx).visible_worktrees(cx).next() else {
@ -442,17 +445,20 @@ impl DapStore {
};
let dap_store = cx.weak_entity();
let definition = session.read(cx).definition();
cx.spawn({
let session = session.clone();
async move |this, cx| {
let binary = this
let mut binary = this
.update(cx, |this, cx| {
this.get_debug_adapter_binary(definition.clone(), cx)
})?
.await?;
if let Some(args) = definition.initialize_args {
merge_json_value_into(args, &mut binary.request_args.configuration);
}
session
.update(cx, |session, cx| {
session.boot(binary, worktree, dap_store, cx)