Allow remote loading for DAP-only extensions (#33981)

Closes #ISSUE


![image](https://github.com/user-attachments/assets/8e1766e4-5d89-4263-875d-ad0dff5c55c2)


Release Notes:

- Allow remote loading for DAP-only extensions
This commit is contained in:
feeiyu 2025-07-06 20:52:16 +08:00 committed by GitHub
parent 01295aa687
commit 2246b01c4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 33 additions and 21 deletions

View file

@ -44,7 +44,9 @@ impl DapLocator for ExtensionLocatorAdapter {
.flatten()
}
async fn run(&self, _build_config: SpawnInTerminal) -> Result<DebugRequest> {
Err(anyhow::anyhow!("Not implemented"))
async fn run(&self, build_config: SpawnInTerminal) -> Result<DebugRequest> {
self.extension
.run_dap_locator(self.locator_name.as_ref().to_owned(), build_config)
.await
}
}

View file

@ -130,6 +130,12 @@ impl ExtensionManifest {
Ok(())
}
pub fn allow_remote_load(&self) -> bool {
!self.language_servers.is_empty()
|| !self.debug_adapters.is_empty()
|| !self.debug_locators.is_empty()
}
}
pub fn build_debug_adapter_schema_path(

View file

@ -1670,7 +1670,7 @@ impl ExtensionStore {
.extensions
.iter()
.filter_map(|(id, entry)| {
if entry.manifest.language_servers.is_empty() {
if !entry.manifest.allow_remote_load() {
return None;
}
Some(proto::Extension {

View file

@ -125,7 +125,7 @@ impl HeadlessExtensionStore {
let manifest = Arc::new(ExtensionManifest::load(fs.clone(), &extension_dir).await?);
debug_assert!(!manifest.languages.is_empty() || !manifest.language_servers.is_empty());
debug_assert!(!manifest.languages.is_empty() || manifest.allow_remote_load());
if manifest.version.as_ref() != extension.version.as_str() {
anyhow::bail!(
@ -165,7 +165,7 @@ impl HeadlessExtensionStore {
})?;
}
if manifest.language_servers.is_empty() {
if !manifest.allow_remote_load() {
return Ok(());
}
@ -187,24 +187,28 @@ impl HeadlessExtensionStore {
);
})?;
}
for (debug_adapter, meta) in &manifest.debug_adapters {
let schema_path = extension::build_debug_adapter_schema_path(debug_adapter, meta);
log::info!("Loaded language server: {}", language_server_id);
}
this.update(cx, |this, _cx| {
this.proxy.register_debug_adapter(
wasm_extension.clone(),
debug_adapter.clone(),
&extension_dir.join(schema_path),
);
})?;
}
for (debug_adapter, meta) in &manifest.debug_adapters {
let schema_path = extension::build_debug_adapter_schema_path(debug_adapter, meta);
for debug_adapter in manifest.debug_locators.keys() {
this.update(cx, |this, _cx| {
this.proxy
.register_debug_locator(wasm_extension.clone(), debug_adapter.clone());
})?;
}
this.update(cx, |this, _cx| {
this.proxy.register_debug_adapter(
wasm_extension.clone(),
debug_adapter.clone(),
&extension_dir.join(schema_path),
);
})?;
log::info!("Loaded debug adapter: {}", debug_adapter);
}
for debug_locator in manifest.debug_locators.keys() {
this.update(cx, |this, _cx| {
this.proxy
.register_debug_locator(wasm_extension.clone(), debug_locator.clone());
})?;
log::info!("Loaded debug locator: {}", debug_locator);
}
Ok(())