extensions/debug-server-ready/src/extension.ts/ServerReadyDetector/startNamedDebugSession
class ServerReadyDetector:	private async startNamedDebugSession(session: vscode.DebugSession, name: string) {
		const args = session.configuration.serverReadyAction as ServerReadyAction;
		if (!args.killOnServerStop) {
			await vscode.debug.startDebugging(session.workspaceFolder, name);
			return;
		}

		const cts = new vscode.CancellationTokenSource();
		const newSessionPromise = this.catchStartedDebugSession(x => x.name === name, cts.token);

		if (!await vscode.debug.startDebugging(session.workspaceFolder, name)) {
			cts.cancel();
			cts.dispose();
			return;
		}

		const createdSession = await newSessionPromise;
		cts.dispose();

		if (!createdSession) {
			return;
		}

		const stopListener = vscode.debug.onDidTerminateDebugSession(async (terminated) => {
			if (terminated === session) {
				stopListener.dispose();
				this.lateDisposables.delete(stopListener);
				await vscode.debug.stopDebugging(createdSession);
			}
		});
		this.lateDisposables.add(stopListener);
	}