Skip to main content

Mountain/Vine/Server/Notification/
SetStatusBarText.rs

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