Skip to main content

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	let Scheme = Parameter.get("scheme").and_then(Value::as_str).unwrap_or("");
15	if Handle == 0 {
16		dev_log!("provider-register", "[ProviderUnregister] uri_handler skip: missing handle");
17		return;
18	}
19	Service
20		.RunTime()
21		.Environment
22		.ApplicationState
23		.Extension
24		.ProviderRegistration
25		.UnregisterProvider(Handle);
26	dev_log!(
27		"provider-register",
28		"[ProviderUnregister] uri_handler handle={} scheme={}",
29		Handle,
30		Scheme
31	);
32}