debugger: Use DAP schema to configure daps (#30833)

This PR allows DAPs to define their own schema so users can see
completion items when editing their debug.json files.

Users facing this aren’t the biggest chance, but behind the scenes, this
affected a lot of code because we manually translated common fields from
Zed's config format to be adapter-specific. Now we store the raw JSON
from a user's configuration file and just send that.

I'm ignoring the Protobuf CICD error because the DebugTaskDefinition
message is not yet user facing and we need to deprecate some fields in
it.

Release Notes:

- debugger beta: Show completion items when editing debug.json
- debugger beta: Breaking change, debug.json schema now relays on what
DAP you have selected instead of always having the same based values.

---------

Co-authored-by: Remco Smits <djsmits12@gmail.com>
Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
Anthony Eid
2025-05-22 05:48:26 -04:00
committed by GitHub
co-authored by Remco Smits Cole Miller Cole Miller
parent 0d7f4842f3
commit 1c9b818342
43 changed files with 2357 additions and 740 deletions
+6 -10
View File
@@ -5,7 +5,7 @@ use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext};
use menu::Confirm;
use project::{FakeFs, Project};
use serde_json::json;
use task::{AttachRequest, TcpArgumentsTemplate};
use task::AttachRequest;
use tests::{init_test, init_test_workspace};
use util::path;
@@ -32,13 +32,12 @@ async fn test_direct_attach_to_process(executor: BackgroundExecutor, cx: &mut Te
cx,
DebugTaskDefinition {
adapter: "fake-adapter".into(),
request: dap::DebugRequest::Attach(AttachRequest {
process_id: Some(10),
}),
label: "label".into(),
initialize_args: None,
config: json!({
"request": "attach",
"process_id": 10,
}),
tcp_connection: None,
stop_on_entry: None,
},
|client| {
client.on_request::<dap::requests::Attach, _>(move |_, args| {
@@ -107,13 +106,10 @@ async fn test_show_attach_modal_and_select_process(
workspace.toggle_modal(window, cx, |window, cx| {
AttachModal::with_processes(
workspace_handle,
DebugTaskDefinition {
task::ZedDebugConfig {
adapter: FakeAdapter::ADAPTER_NAME.into(),
request: dap::DebugRequest::Attach(AttachRequest::default()),
label: "attach example".into(),
initialize_args: None,
tcp_connection: Some(TcpArgumentsTemplate::default()),
stop_on_entry: None,
},
vec![
@@ -24,14 +24,12 @@ use project::{
};
use serde_json::json;
use std::{
collections::HashMap,
path::Path,
sync::{
Arc,
atomic::{AtomicBool, Ordering},
},
};
use task::LaunchRequest;
use terminal_view::terminal_panel::TerminalPanel;
use tests::{active_debug_session_panel, init_test, init_test_workspace};
use util::path;
@@ -1388,16 +1386,15 @@ async fn test_we_send_arguments_from_user_config(
let cx = &mut VisualTestContext::from_window(*workspace, cx);
let debug_definition = DebugTaskDefinition {
adapter: "fake-adapter".into(),
request: dap::DebugRequest::Launch(LaunchRequest {
program: "main.rs".to_owned(),
args: vec!["arg1".to_owned(), "arg2".to_owned()],
cwd: Some(path!("/Random_path").into()),
env: HashMap::from_iter(vec![("KEY".to_owned(), "VALUE".to_owned())]),
config: json!({
"request": "launch",
"program": "main.rs".to_owned(),
"args": vec!["arg1".to_owned(), "arg2".to_owned()],
"cwd": path!("/Random_path"),
"env": json!({ "KEY": "VALUE" }),
}),
label: "test".into(),
initialize_args: None,
tcp_connection: None,
stop_on_entry: None,
};
let launch_handler_called = Arc::new(AtomicBool::new(false));