MCPcopy
hub / github.com/microsoft/vscode-js-debug / VSCodeSessionManager

Class VSCodeSessionManager

src/ui/vsCodeSessionManager.ts:47–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 * interface
46 */
47export class VSCodeSessionManager implements vscode.DebugAdapterDescriptorFactory, IDisposable {
48 private readonly sessionServerManager: ServerSessionManager<vscode.DebugSession>;
49
50 constructor(globalContainer: Container) {
51 this.sessionServerManager = new ServerSessionManager(
52 globalContainer,
53 new VsCodeSessionLauncher(),
54 );
55 }
56
57 /**
58 * @inheritdoc
59 */
60 public async createDebugAdapterDescriptor(
61 debugSession: vscode.DebugSession,
62 ): Promise<vscode.DebugAdapterDescriptor> {
63 const useLocal = process.env.JS_DEBUG_USE_LOCAL_DAP_PORT;
64 if (useLocal) {
65 return new vscode.DebugAdapterServer(+useLocal);
66 }
67
68 const result = await this.sessionServerManager.createDebugServer(debugSession);
69 return new vscode.DebugAdapterNamedPipeServer(result.server.address() as string);
70 }
71
72 /**
73 * @inheritdoc
74 */
75 public terminate(debugSession: vscode.DebugSession) {
76 this.sessionServerManager.terminate(debugSession);
77 }
78
79 /**
80 * @inheritdoc
81 */
82 public dispose() {
83 this.sessionServerManager.dispose();
84 }
85}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected