Skip to content

Commit 85483ef

Browse files
1 parent df31ca1 commit 85483ef

24 files changed

Lines changed: 10887 additions & 7522 deletions

File tree

Source/ApplicationState/State/FeatureState/LifecyclePhase/LifecyclePhaseState.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use std::sync::{Arc, Mutex as StandardMutex};
22

3+
use CommonLibrary::IPC::SkyEvent::SkyEvent;
4+
35
use crate::dev_log;
46

57
/// Application lifecycle phases (mirrors VS Code LifecyclePhase).
@@ -58,7 +60,7 @@ impl LifecyclePhaseState {
5860
_ => "Unknown",
5961
};
6062
if let Err(Error) = ApplicationHandle.emit(
61-
"sky://lifecycle/phaseChanged",
63+
SkyEvent::LifecyclePhaseChanged.AsStr(),
6264
serde_json::json!({
6365
"phase": NewPhase,
6466
"previous": Previous,

Source/ApplicationState/State/WorkspaceState/WorkspaceDelta.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
//! `vscode.workspace.workspaceFolders` returns the fresh list on subsequent
1717
//! synchronous reads.
1818
19+
use CommonLibrary::IPC::SkyEvent::SkyEvent;
1920
use serde_json::json;
2021

2122
use crate::{ApplicationState::DTO::WorkspaceFolderStateDTO::WorkspaceFolderStateDTO, Vine::Client, dev_log};
@@ -125,7 +126,7 @@ pub fn UpdateWorkspaceFoldersAndBroadcast<R:tauri::Runtime>(
125126
.map(FolderToWire)
126127
.collect::<Vec<_>>(),
127128
});
128-
if let Err(Error) = ApplicationHandle.emit("sky://workspaces/changed", BroadcastPayload) {
129+
if let Err(Error) = ApplicationHandle.emit(SkyEvent::WorkspacesChanged.AsStr(), BroadcastPayload) {
129130
dev_log!(
130131
"workspaces",
131132
"warn: [LandFix:WsDelta] sky://workspaces/changed emit failed: {}",

Source/Environment/DiagnosticProvider.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@
191191
// - [ ] Consider implementing diagnostic versioning for change detection
192192
// - [ ] Add support for diagnostic workspace-wide filtering (exclude files)
193193

194-
use CommonLibrary::{Diagnostic::DiagnosticManager::DiagnosticManager, Error::CommonError::CommonError};
194+
use CommonLibrary::{
195+
Diagnostic::DiagnosticManager::DiagnosticManager,
196+
Error::CommonError::CommonError,
197+
IPC::SkyEvent::SkyEvent,
198+
};
195199
use async_trait::async_trait;
196200
use serde_json::{Value, json};
197201
use tauri::Emitter;
@@ -249,7 +253,7 @@ impl DiagnosticManager for MountainEnvironment {
249253
// Include both added/cleared URIs so UI can update accurately.
250254
let EventPayload = json!({ "Owner": Owner, "Uris": ChangedURIKeys });
251255

252-
if let Err(Error) = self.ApplicationHandle.emit("sky://diagnostics/changed", EventPayload) {
256+
if let Err(Error) = self.ApplicationHandle.emit(SkyEvent::DiagnosticsChanged.AsStr(), EventPayload) {
253257
dev_log!(
254258
"extensions",
255259
"error: [DiagnosticProvider] Failed to emit 'diagnostics_changed': {}",
@@ -302,7 +306,7 @@ impl DiagnosticManager for MountainEnvironment {
302306

303307
let EventPayload = json!({ "Owner": Owner, "Uris": ChangedURIKeys });
304308

305-
if let Err(Error) = self.ApplicationHandle.emit("sky://diagnostics/changed", EventPayload) {
309+
if let Err(Error) = self.ApplicationHandle.emit(SkyEvent::DiagnosticsChanged.AsStr(), EventPayload) {
306310
dev_log!(
307311
"extensions",
308312
"error: [DiagnosticProvider] Failed to emit 'diagnostics_changed' on clear: {}",

Source/Environment/DocumentProvider/OpenDocument.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use CommonLibrary::{
1010
Environment::Requires::Requires,
1111
Error::CommonError::CommonError,
1212
FileSystem::ReadFile::ReadFile,
13-
IPC::IPCProvider::IPCProvider,
13+
IPC::{IPCProvider::IPCProvider, SkyEvent::SkyEvent},
1414
};
1515
use serde_json::{Value, json};
1616
use tauri::{Emitter, Manager};
@@ -50,7 +50,7 @@ pub(super) async fn open_document(
5050

5151
match existing_document.ToDTO() {
5252
Ok(dto) => {
53-
if let Err(error) = environment.ApplicationHandle.emit("sky://documents/open", dto) {
53+
if let Err(error) = environment.ApplicationHandle.emit(SkyEvent::DocumentsOpen.AsStr(), dto) {
5454
dev_log!(
5555
"model",
5656
"error: [DocumentProvider] Failed to emit document open event: {}",
@@ -130,7 +130,7 @@ pub(super) async fn open_document(
130130

131131
if let Err(error) = environment
132132
.ApplicationHandle
133-
.emit("sky://documents/open", dto_for_notification.clone())
133+
.emit(SkyEvent::DocumentsOpen.AsStr(), dto_for_notification.clone())
134134
{
135135
dev_log!(
136136
"model",

Source/Environment/DocumentProvider/SaveOperations.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use CommonLibrary::{
88
Effect::ApplicationRunTime::ApplicationRunTime as _,
99
Error::CommonError::CommonError,
1010
FileSystem::WriteFileBytes::WriteFileBytes,
11+
IPC::SkyEvent::SkyEvent,
1112
UserInterface::{DTO::SaveDialogOptionsDTO::SaveDialogOptionsDTO, ShowSaveDialog::ShowSaveDialog},
1213
};
1314
use serde_json::json;
@@ -69,7 +70,7 @@ pub(super) async fn save_document(
6970

7071
if let Err(error) = environment
7172
.ApplicationHandle
72-
.emit("sky://documents/saved", json!({ "uri": uri.to_string() }))
73+
.emit(SkyEvent::DocumentsSaved.AsStr(), json!({ "uri": uri.to_string() }))
7374
{
7475
dev_log!(
7576
"model",
@@ -152,7 +153,7 @@ pub(super) async fn save_document_as(
152153
crate::Environment::DocumentProvider::Notifications::notify_model_added(environment, &new_document_state).await;
153154

154155
if let Err(error) = environment.ApplicationHandle.emit(
155-
"sky://documents/renamed",
156+
SkyEvent::DocumentsRenamed.AsStr(),
156157
json!({ "oldUri": original_uri.to_string(), "newUri": new_uri.to_string() }),
157158
) {
158159
dev_log!(

Source/Environment/FileWatcherProvider.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use CommonLibrary::{
3535
Environment::Requires::Requires,
3636
Error::CommonError::CommonError,
3737
FileSystem::FileWatcherProvider::{FileWatcherProvider, WatchEvent, WatchEventKind},
38-
IPC::IPCProvider::IPCProvider,
38+
IPC::{IPCProvider::IPCProvider, SkyEvent::SkyEvent},
3939
};
4040
use async_trait::async_trait;
4141
use notify::{EventKind, RecommendedWatcher, RecursiveMode, Watcher};
@@ -116,7 +116,7 @@ impl WatcherState {
116116
// Cocoon. Wind's `TauriChannel` subscribes to
117117
// `sky://vfs/fileChange` under the localFilesystem
118118
// channel.
119-
if let Err(Error) = env_clone.ApplicationHandle.emit("sky://vfs/fileChange", &payload) {
119+
if let Err(Error) = env_clone.ApplicationHandle.emit(SkyEvent::VFSFileChange.AsStr(), &payload) {
120120
dev_log!(
121121
"filewatcher",
122122
"warn: [FileWatcherProvider] sky://vfs/fileChange emit failed: {}",

Source/Environment/SourceControlManagementProvider.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
230230
use CommonLibrary::{
231231
Error::CommonError::CommonError,
232+
IPC::SkyEvent::SkyEvent,
232233
SourceControlManagement::{
233234
DTO::{
234235
SourceControlCreateDTO::SourceControlCreateDTO,
@@ -287,7 +288,7 @@ impl SourceControlManagementProvider for MountainEnvironment {
287288
.insert(Handle, Default::default());
288289

289290
self.ApplicationHandle
290-
.emit("sky://scm/provider/added", ProviderState)
291+
.emit(SkyEvent::SCMProviderAdded.AsStr(), ProviderState)
291292
.map_err(|Error| {
292293
CommonError::UserInterfaceInteraction { Reason:format!("Failed to emit scm event: {}", Error) }
293294
})?;
@@ -319,7 +320,7 @@ impl SourceControlManagementProvider for MountainEnvironment {
319320
.remove(&ProviderHandle);
320321

321322
self.ApplicationHandle
322-
.emit("sky://scm/provider/removed", ProviderHandle)
323+
.emit(SkyEvent::SCMProviderRemoved.AsStr(), ProviderHandle)
323324
.map_err(|Error| CommonError::UserInterfaceInteraction { Reason:Error.to_string() })?;
324325

325326
Ok(())
@@ -360,7 +361,7 @@ impl SourceControlManagementProvider for MountainEnvironment {
360361

361362
self.ApplicationHandle
362363
.emit(
363-
"sky://scm/provider/changed",
364+
SkyEvent::SCMProviderChanged.AsStr(),
364365
json!({ "handle": ProviderHandle, "provider": ProviderClone }),
365366
)
366367
.map_err(|Error| CommonError::UserInterfaceInteraction { Reason:Error.to_string() })?;
@@ -405,7 +406,7 @@ impl SourceControlManagementProvider for MountainEnvironment {
405406

406407
self.ApplicationHandle
407408
.emit(
408-
"sky://scm/group/changed",
409+
SkyEvent::SCMGroupChanged.AsStr(),
409410
json!({ "providerHandle": ProviderHandle, "group": GroupClone }),
410411
)
411412
.map_err(|Error| CommonError::UserInterfaceInteraction { Reason:Error.to_string() })?;
@@ -447,7 +448,7 @@ impl SourceControlManagementProvider for MountainEnvironment {
447448

448449
self.ApplicationHandle
449450
.emit(
450-
"sky://scm/provider/changed",
451+
SkyEvent::SCMProviderChanged.AsStr(),
451452
json!({ "handle": ProviderHandle, "provider": ProviderClone }),
452453
)
453454
.map_err(|Error| CommonError::UserInterfaceInteraction { Reason:Error.to_string() })?;

Source/Environment/StatusBarProvider/EntryManagement.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
//! Implementation of status bar entry creation and disposal for
44
//! [`MountainEnvironment`]
55
6-
use CommonLibrary::{Error::CommonError::CommonError, StatusBar::DTO::StatusBarEntryDTO::StatusBarEntryDTO};
6+
use CommonLibrary::{
7+
Error::CommonError::CommonError,
8+
IPC::SkyEvent::SkyEvent,
9+
StatusBar::DTO::StatusBarEntryDTO::StatusBarEntryDTO,
10+
};
711
use serde_json::json;
812
use tauri::Emitter;
913

@@ -30,7 +34,7 @@ pub(super) async fn set_status_bar_entry_impl(
3034
drop(items_guard);
3135

3236
env.ApplicationHandle
33-
.emit("sky://statusbar/set-entry", entry)
37+
.emit(SkyEvent::StatusBarSetEntry.AsStr(), entry)
3438
.map_err(|error| CommonError::UserInterfaceInteraction { Reason:error.to_string() })
3539
}
3640

@@ -50,6 +54,6 @@ pub(super) async fn dispose_status_bar_entry_impl(
5054
.remove(&entry_identifier);
5155

5256
env.ApplicationHandle
53-
.emit("sky://statusbar/dispose-entry", json!({ "EntryIdentifier": entry_identifier }))
57+
.emit(SkyEvent::StatusBarDisposeEntry.AsStr(), json!({ "EntryIdentifier": entry_identifier }))
5458
.map_err(|error| CommonError::UserInterfaceInteraction { Reason:error.to_string() })
5559
}

Source/Environment/StatusBarProvider/MessageManagement.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Implementation of status bar temporary message handling for
44
//! [`MountainEnvironment`]
55
6-
use CommonLibrary::Error::CommonError::CommonError;
6+
use CommonLibrary::{Error::CommonError::CommonError, IPC::SkyEvent::SkyEvent};
77
use serde_json::{Value, json};
88
use tauri::Emitter;
99

@@ -24,7 +24,7 @@ pub(super) async fn set_status_bar_message_impl(
2424
);
2525

2626
env.ApplicationHandle
27-
.emit::<Value>("sky://statusbar/set-message", json!({ "id": message_identifier, "text": text }))
27+
.emit::<Value>(SkyEvent::StatusBarSetMessage.AsStr(), json!({ "id": message_identifier, "text": text }))
2828
.map_err(|error| CommonError::UserInterfaceInteraction { Reason:error.to_string() })
2929
}
3030

@@ -40,6 +40,6 @@ pub(super) async fn dispose_status_bar_message_impl(
4040
);
4141

4242
env.ApplicationHandle
43-
.emit::<Value>("sky://statusbar/dispose-message", json!({ "id": message_identifier }))
43+
.emit::<Value>(SkyEvent::StatusBarDisposeMessage.AsStr(), json!({ "id": message_identifier }))
4444
.map_err(|error| CommonError::UserInterfaceInteraction { Reason:error.to_string() })
4545
}

Source/Environment/TerminalProvider.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ use std::{env, io::Write, sync::Arc};
103103
use CommonLibrary::{
104104
Environment::Requires::Requires,
105105
Error::CommonError::CommonError,
106-
IPC::IPCProvider::IPCProvider,
106+
IPC::{IPCProvider::IPCProvider, SkyEvent::SkyEvent},
107107
Terminal::TerminalProvider::TerminalProvider,
108108
};
109109
use async_trait::async_trait;
@@ -252,7 +252,7 @@ impl TerminalProvider for MountainEnvironment {
252252
}
253253

254254
if let Err(Error) = AppHandleForOutput.emit(
255-
"sky://terminal/data",
255+
SkyEvent::TerminalData.AsStr(),
256256
json!({
257257
"id": TermIDForOutput,
258258
"data": DataString,
@@ -336,7 +336,7 @@ impl TerminalProvider for MountainEnvironment {
336336
// lingers until the next render cycle).
337337
if let Err(Error) = EnvironmentClone
338338
.ApplicationHandle
339-
.emit("sky://terminal/exit", json!({ "id": TermIDForExit }))
339+
.emit(SkyEvent::TerminalExit.AsStr(), json!({ "id": TermIDForExit }))
340340
{
341341
dev_log!(
342342
"terminal",
@@ -359,7 +359,7 @@ impl TerminalProvider for MountainEnvironment {
359359
// waiting for Cocoon to round-trip a notification. The `sky://` event
360360
// channel is already how ShowTerminal / HideTerminal talk to the UI.
361361
if let Err(Error) = self.ApplicationHandle.emit(
362-
"sky://terminal/create",
362+
SkyEvent::TerminalCreate.AsStr(),
363363
json!({
364364
"id": TerminalIdentifier,
365365
"name": Name,
@@ -440,7 +440,7 @@ impl TerminalProvider for MountainEnvironment {
440440

441441
self.ApplicationHandle
442442
.emit(
443-
"sky://terminal/show",
443+
SkyEvent::TerminalShow.AsStr(),
444444
json!({ "id": TerminalId, "preserveFocus": PreserveFocus }),
445445
)
446446
.map_err(|Error| CommonError::UserInterfaceInteraction { Reason:Error.to_string() })
@@ -450,7 +450,7 @@ impl TerminalProvider for MountainEnvironment {
450450
dev_log!("terminal", "[TerminalProvider] Hiding terminal ID: {}", TerminalId);
451451

452452
self.ApplicationHandle
453-
.emit("sky://terminal/hide", json!({ "id": TerminalId }))
453+
.emit(SkyEvent::TerminalHide.AsStr(), json!({ "id": TerminalId }))
454454
.map_err(|Error| CommonError::UserInterfaceInteraction { Reason:Error.to_string() })
455455
}
456456

0 commit comments

Comments
 (0)