Skip to main content

Mountain/Vine/Server/Notification/
OpenExternal.rs

1#![allow(non_snake_case)]
2//! Cocoon → Mountain `openExternal` notification.
3//! Emitted by `Cocoon/.../APIFactoryService.ts:393` when an extension
4//! calls `vscode.env.openExternal(uri)`. Delegates to the platform's
5//! default handler via the `opener` crate (already a Mountain dep via
6//! `nativeHost:openExternal`). Fire-and-forget; success/failure is
7//! logged but not surfaced back to the extension.
8
9use serde_json::Value;
10
11use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
12
13pub async fn OpenExternal(_Service:&MountainVinegRPCService, Parameter:&Value) {
14	let Uri = Parameter.get("uri").and_then(Value::as_str).unwrap_or("");
15	if Uri.is_empty() {
16		dev_log!("grpc", "[OpenExternal] skip: missing uri");
17		return;
18	}
19	match open::that(Uri) {
20		Ok(()) => dev_log!("grpc", "[OpenExternal] uri={} ok", Uri),
21		Err(Error) => dev_log!("grpc", "[OpenExternal] uri={} err={}", Uri, Error),
22	}
23}