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:
parent
0d7f4842f3
commit
1c9b818342
43 changed files with 2357 additions and 740 deletions
|
@ -1,15 +1,15 @@
|
|||
use dap::DebugRequest;
|
||||
use dap::adapters::DebugTaskDefinition;
|
||||
use dap::{DapRegistry, DebugRequest};
|
||||
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||
use gpui::{DismissEvent, Entity, EventEmitter, Focusable, Render};
|
||||
use gpui::{AppContext, DismissEvent, Entity, EventEmitter, Focusable, Render};
|
||||
use gpui::{Subscription, WeakEntity};
|
||||
use picker::{Picker, PickerDelegate};
|
||||
use task::ZedDebugConfig;
|
||||
use util::debug_panic;
|
||||
|
||||
use std::sync::Arc;
|
||||
use sysinfo::System;
|
||||
use ui::{Context, Tooltip, prelude::*};
|
||||
use ui::{ListItem, ListItemSpacing};
|
||||
use util::debug_panic;
|
||||
use workspace::{ModalView, Workspace};
|
||||
|
||||
use crate::debugger_panel::DebugPanel;
|
||||
|
@ -25,7 +25,7 @@ pub(crate) struct AttachModalDelegate {
|
|||
selected_index: usize,
|
||||
matches: Vec<StringMatch>,
|
||||
placeholder_text: Arc<str>,
|
||||
pub(crate) definition: DebugTaskDefinition,
|
||||
pub(crate) definition: ZedDebugConfig,
|
||||
workspace: WeakEntity<Workspace>,
|
||||
candidates: Arc<[Candidate]>,
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ pub(crate) struct AttachModalDelegate {
|
|||
impl AttachModalDelegate {
|
||||
fn new(
|
||||
workspace: WeakEntity<Workspace>,
|
||||
definition: DebugTaskDefinition,
|
||||
definition: ZedDebugConfig,
|
||||
candidates: Arc<[Candidate]>,
|
||||
) -> Self {
|
||||
Self {
|
||||
|
@ -54,7 +54,7 @@ pub struct AttachModal {
|
|||
|
||||
impl AttachModal {
|
||||
pub fn new(
|
||||
definition: DebugTaskDefinition,
|
||||
definition: ZedDebugConfig,
|
||||
workspace: WeakEntity<Workspace>,
|
||||
modal: bool,
|
||||
window: &mut Window,
|
||||
|
@ -83,7 +83,7 @@ impl AttachModal {
|
|||
|
||||
pub(super) fn with_processes(
|
||||
workspace: WeakEntity<Workspace>,
|
||||
definition: DebugTaskDefinition,
|
||||
definition: ZedDebugConfig,
|
||||
processes: Arc<[Candidate]>,
|
||||
modal: bool,
|
||||
window: &mut Window,
|
||||
|
@ -228,7 +228,13 @@ impl PickerDelegate for AttachModalDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
let scenario = self.definition.to_scenario();
|
||||
let Some(scenario) = cx.read_global::<DapRegistry, _>(|registry, _| {
|
||||
registry
|
||||
.adapter(&self.definition.adapter)
|
||||
.and_then(|adapter| adapter.config_from_zed_format(self.definition.clone()).ok())
|
||||
}) else {
|
||||
return;
|
||||
};
|
||||
|
||||
let panel = self
|
||||
.workspace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue