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() .flatten()
} }
async fn run(&self, _build_config: SpawnInTerminal) -> Result<DebugRequest> { async fn run(&self, build_config: SpawnInTerminal) -> Result<DebugRequest> {
Err(anyhow::anyhow!("Not implemented")) self.extension
.run_dap_locator(self.locator_name.as_ref().to_owned(), build_config)
.await
} }
} }

View file

@ -130,6 +130,12 @@ impl ExtensionManifest {
Ok(()) 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( pub fn build_debug_adapter_schema_path(

View file

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

View file

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