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
21	let Text = Parameter.get("text").and_then(Value::as_str).unwrap_or("");
22
23	let Tooltip = Parameter.get("tooltip").and_then(Value::as_str).unwrap_or("");
24
25	let _ = Service.ApplicationHandle().emit(
26		"sky://statusbar/set-entry",
27		json!({
28			"id": Id,
29			"text": Text,
30			"tooltip": Tooltip,
31		}),
32	);
33
34	dev_log!("grpc", "[StatusBar] set-text id={} len={}", Id, Text.len());
35}