Skip to main content

Vine/Server/Notification/
UnregisterCommand.rs

1//! Cocoon → `unregisterCommand` notification.
2//! Removes the proxied `CommandHandler` from the embedder's dispatch registry
3//! so subsequent `commands.executeCommand` no longer routes back to the
4//! extension. Also notifies Sky so the workbench command-service view and
5//! Mountain's registry stay in sync when an extension disposes a command.
6
7use serde_json::{Value, json};
8
9use crate::{Host::VineHost, dev_log};
10
11pub async fn UnregisterCommand(Host:&dyn VineHost, Parameter:&Value) {
12	let CommandId = Parameter.get("commandId").and_then(Value::as_str).unwrap_or("");
13
14	if CommandId.is_empty() {
15		return;
16	}
17
18	Host.UnregisterCommandInRegistry(CommandId);
19
20	dev_log!("command-register", "[UnregisterCommand] id={}", CommandId);
21
22	Host.EmitToRenderer("sky://command/unregister", json!({ "id": CommandId, "commandId": CommandId }));
23}