Mountain/Binary/Register/
CommandRegister.rs

1//! # Command Register Module
2//!
3//! Registers native commands with the Tauri application.
4
5use crate::{ApplicationState::ApplicationState, Command};
6
7/// Registers all native commands with the Tauri application.
8///
9/// # Arguments
10///
11/// * `ApplicationHandle` - The Tauri application handle
12/// * `AppState` - The application state structure
13///
14/// # Returns
15///
16/// A `Result` indicating success or failure.
17///
18/// # Registered Commands
19///
20/// This function delegates to `Command::Bootstrap::RegisterNativeCommands`
21/// which registers all native commands for frontend communication:
22/// - TreeView commands (GetTreeViewChildren)
23/// - Language features (ProvideHover, ProvideCompletions, ProvideDefinition,
24///   ProvideReferences)
25/// - Source Control Management commands
26/// - Keybinding commands
27/// - UI request dispatchers (DispatchFrontendCommand, ResolveUIRequest)
28///
29/// # Errors
30///
31/// Returns an error if command registration fails.
32pub fn CommandRegister(
33	ApplicationHandle:&tauri::AppHandle,
34	AppState:&std::sync::Arc<ApplicationState>,
35) -> Result<(), String> {
36	Command::Bootstrap::RegisterNativeCommands(ApplicationHandle, AppState)
37		.map_err(|Error| format!("Failed to register native commands: {}", Error))?;
38
39	Ok(())
40}