DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/IPC/WindServiceHandlers/UI/KeybindingLookup.rs
1//! Wire method: `keybinding:lookup`.
2
3use std::sync::Arc;
4
5use serde_json::{Value, json};
6
7use crate::RunTime::ApplicationRunTime::ApplicationRunTime;
8
9pub async fn Fn(RunTime:Arc<ApplicationRunTime>, Arguments:Vec<Value>) -> Result<Value, String> {
10 let CommandId = Arguments
11 .first()
12 .and_then(|V| V.as_str())
13 .ok_or("keybinding:lookup requires commandId".to_string())?;
14
15 let Binding = RunTime
16 .Environment
17 .ApplicationState
18 .Feature
19 .Keybindings
20 .LookupKeybinding(CommandId);
21
22 Ok(Binding.map(|B| json!(B)).unwrap_or(Value::Null))
23}