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

		const trackerId = randomUUID();
		const cts = new vscode.CancellationTokenSource();
		const newSessionPromise = this.catchStartedDebugSession(session => session.configuration._debugServerReadySessionId === trackerId, cts.token);

		if (!await this.startBrowserDebugSession(type, session, uri, trackerId)) {
			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);
	}