Common/StatusBar/DTO/
StatusBarEntryDTO.rs

1// File: Common/Source/StatusBar/DTO/StatusBarEntryDTO.rs
2// Role: Defines the Data Transfer Object for a single status bar item.
3// Responsibilities:
4//   - Provide a serializable representation of a `vscode.StatusBarItem`.
5//   - Act as the contract for status bar updates between `Cocoon` and
6//     `Mountain`.
7
8//! # StatusBarEntryDTO
9//!
10//! Defines the Data Transfer Object for a single status bar item.
11
12use serde::{Deserialize, Serialize};
13use serde_json::Value;
14
15/// A serializable struct that represents the complete state of a single status
16/// bar item, analogous to `vscode.StatusBarItem`.
17///
18/// This DTO is sent from the `Cocoon` sidecar to the `Mountain` host whenever
19/// an extension creates or updates a status bar item, providing the host with
20/// all the information needed to render it in the UI.
21#[derive(Serialize, Deserialize, Debug, Clone)]
22#[serde(rename_all = "PascalCase")]
23pub struct StatusBarEntryDTO {
24	/// An internal, host-generated unique ID for this entry instance.
25	pub EntryIdentifier:String,
26
27	/// The identifier of the status bar item, as provided by the extension.
28	pub ItemIdentifier:String,
29
30	/// The identifier of the extension that owns this status bar item.
31	pub ExtensionIdentifier:String,
32
33	/// An optional name for the status bar item, used for identification.
34	#[serde(skip_serializing_if = "Option::is_none")]
35	pub Name:Option<String>,
36
37	/// The text to be displayed for this item (can include icons like
38	/// `$(icon)`).
39	pub Text:String,
40
41	/// The tooltip to show when hovering over the item. Can be a simple string
42	/// or a complex `IMarkdownStringDTO`.
43	#[serde(skip_serializing_if = "Option::is_none")]
44	pub Tooltip:Option<Value>,
45
46	/// A flag indicating if the extension host has a dynamic tooltip provider
47	/// for this item, requiring a reverse RPC call to resolve.
48	pub HasTooltipProvider:bool,
49
50	/// The command to execute when the item is clicked. Serialized
51	/// `CommandDTO`.
52	#[serde(skip_serializing_if = "Option::is_none")]
53	pub Command:Option<Value>,
54
55	/// The foreground color for this item. Serialized `string | ThemeColor`.
56	#[serde(skip_serializing_if = "Option::is_none")]
57	pub Color:Option<Value>,
58
59	/// The background color for this item. Serialized `ThemeColor`.
60	#[serde(skip_serializing_if = "Option::is_none")]
61	pub BackgroundColor:Option<Value>,
62
63	/// If `true`, the item is aligned to the left of the status bar.
64	pub IsAlignedLeft:bool,
65
66	/// The priority of this item. Higher numbers are shown more to the left
67	/// (for left-aligned items) or more to the right (for right-aligned
68	/// items).
69	#[serde(skip_serializing_if = "Option::is_none")]
70	pub Priority:Option<f64>,
71
72	/// Accessibility information for screen readers. Serialized
73	/// `AccessibilityInformation`.
74	#[serde(skip_serializing_if = "Option::is_none")]
75	pub AccessibilityInformation:Option<Value>,
76}