Mountain/Vine/Server/Notification/StatusBarMessage.rs
1//! Cocoon → Mountain `statusBar.message` notification.
2//! Emitted when an extension calls `vscode.window.setStatusBarMessage`
3//! (one-shot text, optional auto-hide). Canonical channel is
4//! `sky://statusbar/set-message`.
5
6use serde_json::{Value, json};
7use tauri::Emitter;
8
9use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
10
11pub async fn StatusBarMessage(Service:&MountainVinegRPCService, Parameter:&Value) {
12 let Text = Parameter.get("text").and_then(Value::as_str).unwrap_or("");
13
14 let HideAfter = Parameter.get("hideAfter").and_then(Value::as_u64);
15
16 if let Err(Error) = Service.ApplicationHandle().emit(
17 "sky://statusbar/set-message",
18 json!({
19 "text": Text,
20 "hideAfter": HideAfter,
21 }),
22 ) {
23 dev_log!(
24 "grpc",
25 "warn: [MountainVinegRPCService] sky://statusbar/set-message emit failed: {}",
26 Error
27 );
28 }
29}