debugger beta: Fix dap_schema for DAP extensions (#31173)

We now actually call dap_schema provided by extensions instead of
defaulting to a null `serde_json::Value`. We still need to update the
Json LSP whenever a new dap is installed.

Release Notes:

- N/A
This commit is contained in:
Anthony Eid 2025-05-22 07:24:46 -04:00 committed by GitHub
parent baf6d82cd4
commit 06f725d51b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 35 additions and 22 deletions

View file

@ -386,7 +386,7 @@ pub trait DebugAdapter: 'static + Send + Sync {
}
}
fn dap_schema(&self) -> serde_json::Value;
async fn dap_schema(&self) -> serde_json::Value;
}
#[cfg(any(test, feature = "test-support"))]
@ -434,7 +434,7 @@ impl DebugAdapter for FakeAdapter {
DebugAdapterName(Self::ADAPTER_NAME.into())
}
fn dap_schema(&self) -> serde_json::Value {
async fn dap_schema(&self) -> serde_json::Value {
serde_json::Value::Null
}

View file

@ -64,13 +64,16 @@ impl DapRegistry {
);
}
pub fn adapters_schema(&self) -> task::AdapterSchemas {
pub async fn adapters_schema(&self) -> task::AdapterSchemas {
let mut schemas = AdapterSchemas(vec![]);
for (name, adapter) in self.0.read().adapters.iter() {
// Clone to avoid holding lock over await points
let adapters = self.0.read().adapters.clone();
for (name, adapter) in adapters.into_iter() {
schemas.0.push(AdapterSchema {
adapter: name.clone().into(),
schema: adapter.dap_schema(),
adapter: name.into(),
schema: adapter.dap_schema().await,
});
}