Skip to main content

Mountain/Vine/Server/Notification/
SetStatusBarText.rs

1#![allow(non_snake_case)]
2//! Cocoon → Mountain `setStatusBarText` notification.
3//! Emitted three times by `Cocoon/.../Services/Window/StatusBar.ts`
4//! (`:92`, `:123`, `:131`) whenever an extension calls
5//! `vscode.window.setStatusBarMessage(...)`, or an extension-owned
6//! `StatusBarItem.text = "..."` mutates. Distinct from the typed
7//! `statusBar.update` notification (which carries colour/tooltip/command
8//! fields): this wire form is the pure text-only fast path.
9//!
10//! Forwards onto `sky://statusbar/set-entry` so the Sky `StatusBar`
11//! shim's existing fan-out listener picks it up without a new channel.
12
13use serde_json::{Value, json};
14use tauri::Emitter;
15
16use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
17
18pub async fn SetStatusBarText(Service:&MountainVinegRPCService, Parameter:&Value) {
19	let Id = Parameter.get("id").and_then(Value::as_str).unwrap_or("");
20	let Text = Parameter.get("text").and_then(Value::as_str).unwrap_or("");
21	let Tooltip = Parameter.get("tooltip").and_then(Value::as_str).unwrap_or("");
22
23	let _ = Service.ApplicationHandle().emit(
24		"sky://statusbar/set-entry",
25		json!({
26			"id": Id,
27			"text": Text,
28			"tooltip": Tooltip,
29		}),
30	);
31	dev_log!("grpc", "[StatusBar] set-text id={} len={}", Id, Text.len());
32}