Skip to main content

Vine/Server/Notification/
OpenExternal.rs

1//! Cocoon `openExternal` notification - extension called
2//! `vscode.env.openExternal(uri)`. Delegates to the platform default
3//! handler via the `opener` crate. Fire-and-forget; success/failure is
4//! logged but not surfaced back to the extension.
5
6use serde_json::Value;
7
8use crate::{Host::VineHost, dev_log};
9
10pub async fn OpenExternal(_Host:&dyn VineHost, Parameter:&Value) {
11	let Uri = Parameter.get("uri").and_then(Value::as_str).unwrap_or("");
12
13	if Uri.is_empty() {
14		dev_log!("grpc", "[OpenExternal] skip: missing uri");
15
16		return;
17	}
18
19	match open::that(Uri) {
20		Ok(()) => dev_log!("grpc", "[OpenExternal] uri={} ok", Uri),
21
22		Err(Error) => dev_log!("grpc", "[OpenExternal] uri={} err={}", Uri, Error),
23	}
24}