Change:
I'm trying to use the configuration from website, but I'm facing a problem with the third option. I would like to use like these: and . But I can't find a way to achieve this with : Is it something possible? Thanks a lot
That launch config works for me and does what's expected. Note that the "serverReadyAction" in the latter config does not call the " debug client-side" launch config. For that you would want to use the and put in " debug client-side" for the .
Yes, I agree with you, both configurations are working as expected. I wasn't very clear in my first message, I will try to explain better. On my NextJs project, I can have the following configurations: The first one start the project and enables debugging on server side, the second one open chrome and enables debugging on client side. If I put on the second configuration, it will work just fine: What I want, is using the third configurations only to : start the project, enable debugging on server/client side and open chrome with my . Is it possible to achieve something like this ? I can't find any option in that case to make my working.
serverReadyAction doesn't accept additional configuration properties to pass to the launch config. The reason for this is mostly that intellisense doesn't work in that action (under the hood it's provided by a different extension) so writing configuration in the nested object is hard. The way to do this is define the separate launch config and reference it. Copying your original configuration set:
Your configuration plus two small additions almost give the result I'm looking for! I still have too issues with this: If I kill the (by clicking on the icon), is not automatically killed dispite the option. When I start , is automatically started, but I can see both elements here: !. Is it possible to hide the last one (wich should be automatically killed when is stopped)? I clearly saw that you explained to me why it was not possible to do this (use on a ) in a single configuration, but is there a "hacky" way the achieve my main goal? Or is something planned in the futur? Or maybe there is a way to fix my remaining concerns with the current configuration?
No, this is not possible and is not something we'd do, since you would not be able to control the debug session in that case. That's a bug, will put in a fix
<!-- AUTHORVERIFICATIONREQUEST --This bug has been fixed in the latest release of ! you can help us out by commenting if things are now working as expected. If things still don't seem right, please ensure you're on version of Insiders (today's or later - you can use in the command palette to check), and leave a comment letting us know what isn't working as expected. Happy Coding!
/verified

Discussion:
private static detectors = new Map<vscode.DebugSession, ServerReadyDetector>(); private static terminalDataListener: vscode.Disposable | undefined; <ins> private readonly stoppedEmitter = new vscode.EventEmitter<void>(); private readonly onDidSessionStop = this.stoppedEmitter.event; private readonly disposables = new Set<vscode.Disposable>([]); </ins> private trigger: Trigger; private shellPid?: number; private regexp: RegExp; <del> private disposables: vscode.Disposable[] = []; private lateDisposables = new Set<vscode.Disposable>([]); </del> static start(session: vscode.DebugSession): ServerReadyDetector | undefined { if (session.configuration.serverReadyAction) {

const detector = ServerReadyDetector.detectors.get(session); if (detector) { ServerReadyDetector.detectors.delete(session); <ins> detector.sessionStopped(); </ins> detector.dispose(); } }

private internalDispose() { this.disposables.forEach(d => d.dispose()); <del> this.disposables = []; </del> <ins> this.disposables.clear(); </ins> } <del> override dispose() { this.lateDisposables.forEach(d => d.dispose()); return super.dispose(); </del> <ins> public sessionStopped() { this.stoppedEmitter.fire(); </ins> } detectPattern(s: string): boolean {

if (matches && matches.length >= 1) { this.openExternalWithString(this.session, matches.length > 1 ? matches[1] : ''); this.trigger.fire(); <del> this.internalDispose(); </del> return true; } }

} private openExternalWithString(session: vscode.DebugSession, captureString: string) { const args: ServerReadyAction = session.configuration.serverReadyAction; let uri;

return; } <del> const stopListener = vscode.debug.onDidTerminateDebugSession(async (terminated) => { if (terminated === session) { stopListener.dispose(); this.lateDisposables.delete(stopListener); await vscode.debug.stopDebugging(createdSession); } </del> <ins> const stopListener = this.onDidSessionStop(async () => { stopListener.dispose(); this.disposables.delete(stopListener); await vscode.debug.stopDebugging(createdSession); </ins> }); <del> this.lateDisposables.add(stopListener); </del> <ins> this.disposables.add(stopListener); </ins> } private startBrowserDebugSession(type: string, session: vscode.DebugSession, uri: string, trackerId?: string) {

return; } <del> const stopListener = vscode.debug.onDidTerminateDebugSession(async (terminated) => { if (terminated === session) { stopListener.dispose(); this.lateDisposables.delete(stopListener); await vscode.debug.stopDebugging(createdSession); } </del> <ins> const stopListener = this.onDidSessionStop(async () => { stopListener.dispose(); this.disposables.delete(stopListener); await vscode.debug.stopDebugging(createdSession); </ins> }); <del> this.lateDisposables.add(stopListener); </del> <ins> this.disposables.add(stopListener); </ins> } private catchStartedDebugSession(predicate: (session: vscode.DebugSession) => boolean, cancellationToken: vscode.CancellationToken): Promise<vscode.DebugSession | undefined> {

const done = (value?: vscode.DebugSession) => { listener.dispose(); cancellationListener.dispose(); <del> this.lateDisposables.delete(listener); this.lateDisposables.delete(cancellationListener); </del> <ins> this.disposables.delete(listener); this.disposables.delete(cancellationListener); </ins> _resolve(value); };

}); // In case the debug session of interest was never caught anyhow. <del> this.lateDisposables.add(listener); this.lateDisposables.add(cancellationListener); </del> <ins> this.disposables.add(listener); this.disposables.add(cancellationListener); </ins> }); } }