Skip to main content

DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/IPC/WindServiceHandlers/ExtensionHost/
Starter.rs

1#![allow(non_snake_case, unused_variables, dead_code, unused_imports)]
2
3//! Wire methods: `extensionHostStarter:*`.
4//! Bridges VS Code's `IExtensionHostStarter` channel to Mountain/Cocoon.
5//! `createExtensionHost` allocates a stub id; `start` returns Cocoon's real
6//! PID so debuggers attach to the correct Node.js process.
7
8use serde_json::{Value, json};
9
10pub async fn ExtensionHostStarterCreate(_Arguments:Vec<Value>) -> Result<Value, String> {
11	crate::dev_log!("exthost", "extensionHostStarter:createExtensionHost");
12	Ok(json!({ "id": "1" }))
13}
14
15pub async fn ExtensionHostStarterStart(_Arguments:Vec<Value>) -> Result<Value, String> {
16	// The renderer uses this PID to correlate extension-host debug adapters
17	// with the actual Node.js process. That process is Cocoon, not Mountain -
18	// returning `std::process::id()` here would point the debugger at
19	// Mountain's Rust binary. Fall back to Mountain's PID only if Cocoon
20	// hasn't spawned yet (should not happen for a real extension-host start).
21	let Pid = crate::ProcessManagement::CocoonManagement::GetCocoonPid().unwrap_or_else(std::process::id);
22	crate::dev_log!("exthost", "extensionHostStarter:start pid={}", Pid);
23	Ok(json!({ "pid": Pid }))
24}
25
26pub async fn ExtensionHostStarterKill(_Arguments:Vec<Value>) -> Result<Value, String> {
27	crate::dev_log!("exthost", "extensionHostStarter:kill");
28	Ok(Value::Null)
29}
30
31pub async fn ExtensionHostStarterGetExitInfo(_Arguments:Vec<Value>) -> Result<Value, String> {
32	crate::dev_log!("exthost", "extensionHostStarter:getExitInfo");
33	Ok(json!({ "code": null, "signal": null }))
34}