diff --git a/src/vs/workbench/contrib/debug/browser/debugService.ts b/src/vs/workbench/contrib/debug/browser/debugService.ts index 3c43ab2954fdc..738c1057981da 100644 --- a/src/vs/workbench/contrib/debug/browser/debugService.ts +++ b/src/vs/workbench/contrib/debug/browser/debugService.ts @@ -675,6 +675,39 @@ export class DebugService implements IDebugService { return; } + // Read the configuration again if a launch.json has been changed, if not just use the inmemory configuration + let needsToSubstitute = false; + let unresolved: IConfig | undefined; + const launch = session.root ? this.configurationManager.getLaunch(session.root.uri) : undefined; + if (launch) { + unresolved = launch.getConfiguration(session.configuration.name); + if (unresolved && !equals(unresolved, session.unresolvedConfiguration)) { + // Take the type from the session since the debug extension might overwrite it #21316 + unresolved.type = session.configuration.type; + unresolved.noDebug = session.configuration.noDebug; + needsToSubstitute = true; + } + } + + let resolved: IConfig | undefined | null = session.configuration; + if (launch && needsToSubstitute && unresolved) { + const initCancellationToken = new CancellationTokenSource(); + this.sessionCancellationTokens.set(session.getId(), initCancellationToken); + const resolvedByProviders = await this.configurationManager.resolveConfigurationByProviders(launch.workspace ? launch.workspace.uri : undefined, unresolved.type, unresolved, initCancellationToken.token); + if (resolvedByProviders) { + resolved = await this.substituteVariables(launch, resolvedByProviders); + if (resolved && !initCancellationToken.token.isCancellationRequested) { + resolved = await this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(launch && launch.workspace ? launch.workspace.uri : undefined, unresolved.type, resolved, initCancellationToken.token); + } + } else { + resolved = resolvedByProviders; + } + } + if (resolved) { + session.setConfiguration({ resolved, unresolved }); + } + session.configuration.__restart = restartData; + if (session.capabilities.supportsRestartRequest) { const taskResult = await runTasks(); if (taskResult === TaskRunResult.Success) { @@ -699,42 +732,10 @@ export class DebugService implements IDebugService { return; } - // Read the configuration again if a launch.json has been changed, if not just use the inmemory configuration - let needsToSubstitute = false; - let unresolved: IConfig | undefined; - const launch = session.root ? this.configurationManager.getLaunch(session.root.uri) : undefined; - if (launch) { - unresolved = launch.getConfiguration(session.configuration.name); - if (unresolved && !equals(unresolved, session.unresolvedConfiguration)) { - // Take the type from the session since the debug extension might overwrite it #21316 - unresolved.type = session.configuration.type; - unresolved.noDebug = session.configuration.noDebug; - needsToSubstitute = true; - } - } - - let resolved: IConfig | undefined | null = session.configuration; - if (launch && needsToSubstitute && unresolved) { - const initCancellationToken = new CancellationTokenSource(); - this.sessionCancellationTokens.set(session.getId(), initCancellationToken); - const resolvedByProviders = await this.configurationManager.resolveConfigurationByProviders(launch.workspace ? launch.workspace.uri : undefined, unresolved.type, unresolved, initCancellationToken.token); - if (resolvedByProviders) { - resolved = await this.substituteVariables(launch, resolvedByProviders); - if (resolved && !initCancellationToken.token.isCancellationRequested) { - resolved = await this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(launch && launch.workspace ? launch.workspace.uri : undefined, unresolved.type, resolved, initCancellationToken.token); - } - } else { - resolved = resolvedByProviders; - } - } - if (!resolved) { return c(undefined); } - session.setConfiguration({ resolved, unresolved }); - session.configuration.__restart = restartData; - try { await this.launchOrAttachToSession(session, shouldFocus); this._onDidNewSession.fire(session); diff --git a/src/vs/workbench/contrib/debug/browser/debugSession.ts b/src/vs/workbench/contrib/debug/browser/debugSession.ts index 1c7f06bc92eeb..9d5ad4af3bcc4 100644 --- a/src/vs/workbench/contrib/debug/browser/debugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/debugSession.ts @@ -337,7 +337,7 @@ export class DebugSession implements IDebugSession { } this.cancelAllRequests(); - await this.raw.restart(); + await this.raw.restart({ arguments: this.configuration }); } async sendBreakpoints(modelUri: URI, breakpointsToSend: IBreakpoint[], sourceModified: boolean): Promise { diff --git a/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts b/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts index 0e405a986de86..22fcf81e7fbf0 100644 --- a/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts @@ -303,9 +303,9 @@ export class RawDebugSession implements IDisposable { return Promise.reject(new Error('terminated not supported')); } - restart(): Promise { + restart(args: DebugProtocol.RestartArguments): Promise { if (this.capabilities.supportsRestartRequest) { - return this.send('restart', null); + return this.send('restart', args); } return Promise.reject(new Error('restart not supported')); }