Mountain/Vine/Server/Notification/UnregisterUriHandler.rs
1#![allow(non_snake_case)]
2//! Cocoon → Mountain `unregister_uri_handler` notification.
3//! Emitted by `Cocoon/.../WindowNamespace.ts:786` when
4//! `vscode.window.registerUriHandler(...).dispose()` fires. Carries the
5//! handle the paired `register_uri_handler` stored and (optionally) the
6//! scheme bound to it.
7
8use serde_json::Value;
9
10use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
11
12pub async fn UnregisterUriHandler(Service:&MountainVinegRPCService, Parameter:&Value) {
13 let Handle = Parameter.get("handle").and_then(Value::as_u64).unwrap_or(0) as u32;
14
15 let Scheme = Parameter.get("scheme").and_then(Value::as_str).unwrap_or("");
16
17 if Handle == 0 {
18 dev_log!("provider-register", "[ProviderUnregister] uri_handler skip: missing handle");
19
20 return;
21 }
22
23 Service
24 .RunTime()
25 .Environment
26 .ApplicationState
27 .Extension
28 .ProviderRegistration
29 .UnregisterProvider(Handle);
30
31 dev_log!(
32 "provider-register",
33 "[ProviderUnregister] uri_handler handle={} scheme={}",
34 Handle,
35 Scheme
36 );
37}