Common/Keybinding/KeybindingProvider.rs
1// File: Common/Source/Keybinding/KeybindingProvider.rs
2// Role: Defines the abstract service trait for resolving and providing
3// keybindings. Responsibilities:
4// - Provide a contract for resolving the final, effective keymap by merging
5// default keybindings with user-defined ones from keybindings.json.
6
7//! # KeybindingProvider Trait
8//!
9//! Defines the abstract service trait for resolving and providing keybindings.
10
11use async_trait::async_trait;
12use serde_json::Value;
13
14use crate::{Environment::Environment::Environment, Error::CommonError::CommonError};
15
16/// An abstract service contract for an environment component that can resolve
17/// the final, effective keymap for the application by merging default and
18/// user-defined keybindings.
19#[async_trait]
20pub trait KeybindingProvider: Environment + Send + Sync {
21 /// Resolves and retrieves the complete list of active keybinding rules.
22 ///
23 /// This method should read default keybindings contributed by extensions,
24
25 /// merge them with user-defined keybindings from `keybindings.json`, and
26 /// return the final list.
27 ///
28 /// # Returns
29 /// A `Result` containing a `Value` that is a JSON array of
30 /// `KeybindingRuleDTO`s.
31 async fn GetResolvedKeybinding(&self) -> Result<Value, CommonError>;
32}