debugger: Add extensions support (#30625)
Closes #ISSUE Release Notes: - N/A --------- Co-authored-by: Anthony <anthony@zed.dev>
This commit is contained in:
parent
6fc9036063
commit
9826b7b5c1
21 changed files with 402 additions and 13 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue