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
|
@ -4,7 +4,9 @@ use collections::FxHashMap;
|
|||
use gpui::{App, Global, SharedString};
|
||||
use language::LanguageName;
|
||||
use parking_lot::RwLock;
|
||||
use task::{DebugRequest, DebugScenario, SpawnInTerminal, TaskTemplate};
|
||||
use task::{
|
||||
AdapterSchema, AdapterSchemas, DebugRequest, DebugScenario, SpawnInTerminal, TaskTemplate,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
adapters::{DebugAdapter, DebugAdapterName},
|
||||
|
@ -41,14 +43,7 @@ impl Global for DapRegistry {}
|
|||
|
||||
impl DapRegistry {
|
||||
pub fn global(cx: &mut App) -> &mut Self {
|
||||
let ret = cx.default_global::<Self>();
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
if ret.adapter(crate::FakeAdapter::ADAPTER_NAME).is_none() {
|
||||
ret.add_adapter(Arc::new(crate::FakeAdapter::new()));
|
||||
}
|
||||
|
||||
ret
|
||||
cx.default_global::<Self>()
|
||||
}
|
||||
|
||||
pub fn add_adapter(&self, adapter: Arc<dyn DebugAdapter>) {
|
||||
|
@ -69,6 +64,19 @@ impl DapRegistry {
|
|||
);
|
||||
}
|
||||
|
||||
pub fn adapters_schema(&self) -> task::AdapterSchemas {
|
||||
let mut schemas = AdapterSchemas(vec![]);
|
||||
|
||||
for (name, adapter) in self.0.read().adapters.iter() {
|
||||
schemas.0.push(AdapterSchema {
|
||||
adapter: name.clone().into(),
|
||||
schema: adapter.dap_schema(),
|
||||
});
|
||||
}
|
||||
|
||||
schemas
|
||||
}
|
||||
|
||||
pub fn add_inline_value_provider(
|
||||
&self,
|
||||
language: String,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue