DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/IPC/WindServiceHandlers/Terminal/TerminalShow.rs
1//! Bring a terminal to the foreground in the panel. When
2//! `PreserveFocus` is `true`, the active editor keeps keyboard
3//! focus (mirrors `vscode.Terminal.show(preserveFocus)`).
4
5use std::sync::Arc;
6
7use CommonLibrary::Terminal::TerminalProvider::TerminalProvider;
8use serde_json::Value;
9
10use crate::{
11 IPC::WindServiceHandlers::Utilities::JsonValueHelpers::{arg_bool, arg_u64},
12 RunTime::ApplicationRunTime::ApplicationRunTime,
13};
14
15pub async fn Fn(RunTime:Arc<ApplicationRunTime>, Arguments:Vec<Value>) -> Result<Value, String> {
16 let TerminalId = arg_u64(&Arguments, 0);
17
18 let PreserveFocus = arg_bool(&Arguments, 1);
19
20 RunTime
21 .Environment
22 .ShowTerminal(TerminalId, PreserveFocus)
23 .await
24 .map(|()| Value::Null)
25 .map_err(|Error| format!("terminal:show failed: {}", Error))
26}