Skip to main content

Mountain/Vine/Server/Notification/
WindowShowMessage.rs

1#![allow(non_snake_case)]
2//! Cocoon → Mountain `window.showMessage` notification.
3//! Fires when an extension calls `vscode.window.showInformationMessage`
4//! / `showWarningMessage` / `showErrorMessage`. Forwards on
5//! `sky://notification/show` so the toast stack renders without a
6//! round-trip back to Cocoon.
7//!
8//! Distinct from `Window.ShowMessage` (capitalised) - that variant is
9//! a round-trip **request** (sendRequest) awaiting the user's button
10//! selection; this one is the fire-and-forget notification form.
11
12use serde_json::Value;
13use tauri::Emitter;
14
15use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
16
17pub async fn WindowShowMessage(Service:&MountainVinegRPCService, Parameter:&Value) {
18	dev_log!(
19		"grpc",
20		"[WindowShowMessage] message={:?}",
21		Parameter.get("message").and_then(Value::as_str).unwrap_or("")
22	);
23	if let Err(Error) = Service.ApplicationHandle().emit("sky://notification/show", Parameter) {
24		dev_log!(
25			"grpc",
26			"warn: [MountainVinegRPCService] Failed to emit sky://notification/show: {}",
27			Error
28		);
29	}
30}