debugger: Add extensions support (#30625)

Closes #ISSUE

Release Notes:

- N/A

---------

Co-authored-by: Anthony <anthony@zed.dev>
This commit is contained in:
Piotr Osiewicz
2025-05-13 22:42:51 +00:00
committed by GitHub
co-authored by Anthony
parent 6fc9036063
commit 9826b7b5c1
21 changed files with 402 additions and 13 deletions
+7
View File
@@ -135,6 +135,13 @@ pub trait Extension: Send + Sync + 'static {
package_name: Arc<str>,
kv_store: Arc<dyn KeyValueStoreDelegate>,
) -> Result<()>;
async fn get_dap_binary(
&self,
dap_name: Arc<str>,
config: DebugTaskDefinition,
user_installed_path: Option<PathBuf>,
) -> Result<DebugAdapterBinary>;
}
pub fn parse_wasm_extension_version(
@@ -29,6 +29,7 @@ pub struct ExtensionHostProxy {
slash_command_proxy: RwLock<Option<Arc<dyn ExtensionSlashCommandProxy>>>,
context_server_proxy: RwLock<Option<Arc<dyn ExtensionContextServerProxy>>>,
indexed_docs_provider_proxy: RwLock<Option<Arc<dyn ExtensionIndexedDocsProviderProxy>>>,
debug_adapter_provider_proxy: RwLock<Option<Arc<dyn ExtensionDebugAdapterProviderProxy>>>,
}
impl ExtensionHostProxy {
@@ -54,6 +55,7 @@ impl ExtensionHostProxy {
slash_command_proxy: RwLock::default(),
context_server_proxy: RwLock::default(),
indexed_docs_provider_proxy: RwLock::default(),
debug_adapter_provider_proxy: RwLock::default(),
}
}
@@ -93,6 +95,11 @@ impl ExtensionHostProxy {
.write()
.replace(Arc::new(proxy));
}
pub fn register_debug_adapter_proxy(&self, proxy: impl ExtensionDebugAdapterProviderProxy) {
self.debug_adapter_provider_proxy
.write()
.replace(Arc::new(proxy));
}
}
pub trait ExtensionThemeProxy: Send + Sync + 'static {
@@ -402,3 +409,17 @@ impl ExtensionIndexedDocsProviderProxy for ExtensionHostProxy {
proxy.register_indexed_docs_provider(extension, provider_id)
}
}
pub trait ExtensionDebugAdapterProviderProxy: Send + Sync + 'static {
fn register_debug_adapter(&self, extension: Arc<dyn Extension>, debug_adapter_name: Arc<str>);
}
impl ExtensionDebugAdapterProviderProxy for ExtensionHostProxy {
fn register_debug_adapter(&self, extension: Arc<dyn Extension>, debug_adapter_name: Arc<str>) {
let Some(proxy) = self.debug_adapter_provider_proxy.read().clone() else {
return;
};
proxy.register_debug_adapter(extension, debug_adapter_name)
}
}
+2
View File
@@ -1,10 +1,12 @@
mod context_server;
mod dap;
mod lsp;
mod slash_command;
use std::ops::Range;
pub use context_server::*;
pub use dap::*;
pub use lsp::*;
pub use slash_command::*;
+5
View File
@@ -0,0 +1,5 @@
pub use dap::{
StartDebuggingRequestArguments, StartDebuggingRequestArgumentsRequest,
adapters::{DebugAdapterBinary, DebugTaskDefinition, TcpArguments},
};
pub use task::{AttachRequest, DebugRequest, LaunchRequest, TcpArgumentsTemplate};