Skip to content

Commit 02ffd1d

Browse files
feat(Handler/ui): Add native dialog handler for extension messages
- Introduce `ui` handler module in Mountain backend to process UI commands from Cocoon shim - Implement `handle_show_message` using Tauri's native dialog API instead of web-based alerts - Map VS Code extension message severity levels (Error/Warn/Info) to native dialog titles - Add structured logging for extension message events through stdio - Improve code formatting with rustfmt for better maintainability This change replaces Electron's web-based dialogs with Tauri's native implementations, aligning with Land's performance goals by reducing webview interaction overhead. The handler enables VS Code extensions using `window.showErrorMessage`/`showWarningMessage` APIs to function through Cocoon shim layer while maintaining native UI consistency.
1 parent 52e8fbe commit 02ffd1d

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

Source/Library.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ pub mod handlers {
4040
pub mod storage;
4141

4242
pub mod terminal;
43+
44+
pub mod ui;
4345
}

Source/handlers/ui.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,21 @@ use tauri::{Runtime, Window};
2525

2626
// Handler for ui_showMessage proxied from Cocoon shim
2727
pub async fn handle_show_message<R:Runtime>(window:Window<R>, params:Value) -> Result<Value, String> {
28-
let severity = params.get("severity").and_then(|v| v.as_u64()).unwrap_or(2); // Default Info
28+
// Default Info
29+
let severity = params.get("severity").and_then(|v| v.as_u64()).unwrap_or(2);
30+
2931
let message = params.get("message").and_then(|v| v.as_str()).unwrap_or("");
32+
3033
println!("[UI Handler] ShowMessage severity={}, message={}", severity, message);
3134

3235
// Map severity if needed
3336
let title = match severity {
34-
1 => "Extension Warning", // Warn
35-
0 => "Extension Error", // Error
36-
_ => "Extension Info", // Info/default
37+
// Warn
38+
1 => "Extension Warning",
39+
// Error
40+
0 => "Extension Error",
41+
// Info/default
42+
_ => "Extension Info",
3743
};
3844

3945
// Use Tauri's dialog API

0 commit comments

Comments
 (0)